diff --git a/src/languages/postgresql/postgresql.functions.ts b/src/languages/postgresql/postgresql.functions.ts index 8d9abc738e..e59b463188 100644 --- a/src/languages/postgresql/postgresql.functions.ts +++ b/src/languages/postgresql/postgresql.functions.ts @@ -232,7 +232,7 @@ export const functions: string[] = [ 'NETMASK', 'NETWORK', 'SET_MASKLEN', - 'TEXT', + // 'TEXT', // excluded because it's also a data type name 'TRUNC', // https://www.postgresql.org/docs/14/functions-textsearch.html diff --git a/test/postgresql.test.ts b/test/postgresql.test.ts index 47c40619c3..da35470cc8 100644 --- a/test/postgresql.test.ts +++ b/test/postgresql.test.ts @@ -345,4 +345,23 @@ describe('PostgreSqlFormatter', () => { id; `); }); + + // Issue #726 + it('treats TEXT as data-type (not as plain keyword)', () => { + expect( + format(`CREATE TABLE foo (items text);`, { + dataTypeCase: 'upper', + }) + ).toBe(dedent` + CREATE TABLE foo (items TEXT); + `); + + expect( + format(`CREATE TABLE foo (text VARCHAR(100));`, { + keywordCase: 'upper', + }) + ).toBe(dedent` + CREATE TABLE foo (text VARCHAR(100)); + `); + }); });