Skip to content

Commit c71cf6f

Browse files
committed
Support OR REPLACE in CREATE FUNCTION of PostgreSQL
Refs #813
1 parent 121f6ac commit c71cf6f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/languages/postgresql/postgresql.formatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const tabularOnelineClauses = expandPhrases([
126126
'CREATE EXTENSION',
127127
'CREATE FOREIGN DATA WRAPPER',
128128
'CREATE FOREIGN TABLE',
129-
'CREATE FUNCTION',
129+
'CREATE [OR REPLACE] FUNCTION',
130130
'CREATE GROUP',
131131
'CREATE INDEX',
132132
'CREATE LANGUAGE',

test/postgresql.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,4 +383,11 @@ describe('PostgreSqlFormatter', () => {
383383
foo operator ( !== ) bar;
384384
`);
385385
});
386+
387+
// Issue #813
388+
it('supports OR REPLACE in CREATE FUNCTION', () => {
389+
expect(format(`CREATE OR REPLACE FUNCTION foo ();`)).toBe(dedent`
390+
CREATE OR REPLACE FUNCTION foo ();
391+
`);
392+
});
386393
});

0 commit comments

Comments
 (0)