Skip to content

Commit c1a6f08

Browse files
committed
Support ARRAY[] syntax in Redshift
Refs #884
1 parent 66c219b commit c1a6f08

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/languages/redshift/redshift.formatter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export const redshift: DialectOptions = {
157157
reservedKeywords: keywords,
158158
reservedDataTypes: dataTypes,
159159
reservedFunctionNames: functions,
160+
extraParens: ['[]'],
160161
stringTypes: ["''-qq"],
161162
identTypes: [`""-qq`],
162163
identChars: { first: '#' },

src/languages/redshift/redshift.functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const functions: string[] = [
1616
'VAR_POP',
1717

1818
// https://docs.aws.amazon.com/redshift/latest/dg/c_Array_Functions.html
19-
'array',
19+
// 'array',
2020
'array_concat',
2121
'array_flatten',
2222
'get_array_length',

test/redshift.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import supportsUpdate from './features/update.js';
2121
import supportsParams from './options/param.js';
2222
import supportsDataTypeCase from './options/dataTypeCase.js';
2323
import supportsNumbers from './features/numbers.js';
24+
import supportsArrayLiterals from './features/arrayLiterals.js';
2425

2526
describe('RedshiftFormatter', () => {
2627
const language = 'redshift';
@@ -54,6 +55,7 @@ describe('RedshiftFormatter', () => {
5455
supportsParams(format, { numbered: ['$'] });
5556
supportsLimiting(format, { limit: true, offset: true });
5657
supportsDataTypeCase(format);
58+
supportsArrayLiterals(format, { withArrayPrefix: true });
5759

5860
it('formats type-cast operator without spaces', () => {
5961
expect(format('SELECT 2 :: numeric AS foo;')).toBe(dedent`

0 commit comments

Comments
 (0)