Skip to content

Commit

Permalink
Support OR REPLACE in CREATE FUNCTION of PostgreSQL
Browse files Browse the repository at this point in the history
Refs #813
  • Loading branch information
nene committed Dec 23, 2024
1 parent 121f6ac commit c71cf6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/languages/postgresql/postgresql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const tabularOnelineClauses = expandPhrases([
'CREATE EXTENSION',
'CREATE FOREIGN DATA WRAPPER',
'CREATE FOREIGN TABLE',
'CREATE FUNCTION',
'CREATE [OR REPLACE] FUNCTION',
'CREATE GROUP',
'CREATE INDEX',
'CREATE LANGUAGE',
Expand Down
7 changes: 7 additions & 0 deletions test/postgresql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,11 @@ describe('PostgreSqlFormatter', () => {
foo operator ( !== ) bar;
`);
});

// Issue #813
it('supports OR REPLACE in CREATE FUNCTION', () => {
expect(format(`CREATE OR REPLACE FUNCTION foo ();`)).toBe(dedent`
CREATE OR REPLACE FUNCTION foo ();
`);
});
});

0 comments on commit c71cf6f

Please sign in to comment.