Skip to content

Commit

Permalink
Remove some common table/field names from PostgreSQL keywords
Browse files Browse the repository at this point in the history
Fixes #156
  • Loading branch information
nene committed Dec 7, 2023
1 parent cd7ec6c commit d34557b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/languages/postgresql/postgresql.keywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export const keywords: string[] = [
'ISOLATION',
'JOIN', // reserved (can be function or type)
'KEY',
'LABEL',
'LANGUAGE',
'LARGE',
'LAST',
Expand All @@ -208,7 +207,6 @@ export const keywords: string[] = [
'LOCAL',
'LOCALTIME', // reserved
'LOCALTIMESTAMP', // reserved
'LOCATION',
'LOCK',
'LOCKED',
'LOGGED',
Expand All @@ -222,8 +220,6 @@ export const keywords: string[] = [
'MODE',
'MONTH', // requires AS
'MOVE',
'NAME',
'NAMES',
'NATIONAL', // (cannot be function or type)
'NATURAL', // reserved (can be function or type)
'NCHAR', // (cannot be function or type)
Expand Down Expand Up @@ -302,7 +298,6 @@ export const keywords: string[] = [
'REFRESH',
'REINDEX',
'RELATIVE',
'RELEASE',
'RENAME',
'REPEATABLE',
'REPLACE',
Expand Down Expand Up @@ -384,8 +379,6 @@ export const keywords: string[] = [
'TRUE', // reserved
'TRUNCATE',
'TRUSTED',
'TYPE',
'TYPES',
'UESCAPE',
'UNBOUNDED',
'UNCOMMITTED',
Expand Down
15 changes: 15 additions & 0 deletions test/postgresql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,19 @@ describe('PostgreSqlFormatter', () => {
items;
`);
});

// Issue #156
it('does not recognize common fields names as keywords', () => {
expect(format(`SELECT id, type, name, location, label FROM release;`, { keywordCase: 'upper' }))
.toBe(dedent`
SELECT
id,
type,
name,
location,
label
FROM
release;
`);
});
});

0 comments on commit d34557b

Please sign in to comment.