Skip to content

Commit

Permalink
Support pgvector operators in PostgreSQL
Browse files Browse the repository at this point in the history
Fixes #807
  • Loading branch information
nene committed Dec 19, 2024
1 parent f3b6cdb commit b9cde74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/languages/postgresql/postgresql.formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ export const postgresql: DialectOptions = {
// Type cast
'::',
':',
// Custom operators defined by pgvector extension
// https://github.com/pgvector/pgvector#querying
'<#>',
'<=>',
'<+>',
'<~>',
'<%>',
],
operatorKeyword: true,
},
Expand Down
6 changes: 6 additions & 0 deletions test/postgresql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ describe('PostgreSqlFormatter', () => {
'<->>',
'<<<->',
'<->>>',
// Custom operators: from pgvector extension
'<#>',
'<=>',
'<+>',
'<~>',
'<%>',
],
{ any: true }
);
Expand Down

0 comments on commit b9cde74

Please sign in to comment.