Skip to content

Commit d34557b

Browse files
committed
Remove some common table/field names from PostgreSQL keywords
Fixes #156
1 parent cd7ec6c commit d34557b

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Diff for: src/languages/postgresql/postgresql.keywords.ts

-7
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ export const keywords: string[] = [
191191
'ISOLATION',
192192
'JOIN', // reserved (can be function or type)
193193
'KEY',
194-
'LABEL',
195194
'LANGUAGE',
196195
'LARGE',
197196
'LAST',
@@ -208,7 +207,6 @@ export const keywords: string[] = [
208207
'LOCAL',
209208
'LOCALTIME', // reserved
210209
'LOCALTIMESTAMP', // reserved
211-
'LOCATION',
212210
'LOCK',
213211
'LOCKED',
214212
'LOGGED',
@@ -222,8 +220,6 @@ export const keywords: string[] = [
222220
'MODE',
223221
'MONTH', // requires AS
224222
'MOVE',
225-
'NAME',
226-
'NAMES',
227223
'NATIONAL', // (cannot be function or type)
228224
'NATURAL', // reserved (can be function or type)
229225
'NCHAR', // (cannot be function or type)
@@ -302,7 +298,6 @@ export const keywords: string[] = [
302298
'REFRESH',
303299
'REINDEX',
304300
'RELATIVE',
305-
'RELEASE',
306301
'RENAME',
307302
'REPEATABLE',
308303
'REPLACE',
@@ -384,8 +379,6 @@ export const keywords: string[] = [
384379
'TRUE', // reserved
385380
'TRUNCATE',
386381
'TRUSTED',
387-
'TYPE',
388-
'TYPES',
389382
'UESCAPE',
390383
'UNBOUNDED',
391384
'UNCOMMITTED',

Diff for: test/postgresql.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,19 @@ describe('PostgreSqlFormatter', () => {
312312
items;
313313
`);
314314
});
315+
316+
// Issue #156
317+
it('does not recognize common fields names as keywords', () => {
318+
expect(format(`SELECT id, type, name, location, label FROM release;`, { keywordCase: 'upper' }))
319+
.toBe(dedent`
320+
SELECT
321+
id,
322+
type,
323+
name,
324+
location,
325+
label
326+
FROM
327+
release;
328+
`);
329+
});
315330
});

0 commit comments

Comments
 (0)