Skip to content

Commit b9cde74

Browse files
committed
Support pgvector operators in PostgreSQL
Fixes #807
1 parent f3b6cdb commit b9cde74

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/languages/postgresql/postgresql.formatter.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ export const postgresql: DialectOptions = {
367367
// Type cast
368368
'::',
369369
':',
370+
// Custom operators defined by pgvector extension
371+
// https://github.com/pgvector/pgvector#querying
372+
'<#>',
373+
'<=>',
374+
'<+>',
375+
'<~>',
376+
'<%>',
370377
],
371378
operatorKeyword: true,
372379
},

test/postgresql.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ describe('PostgreSqlFormatter', () => {
146146
'<->>',
147147
'<<<->',
148148
'<->>>',
149+
// Custom operators: from pgvector extension
150+
'<#>',
151+
'<=>',
152+
'<+>',
153+
'<~>',
154+
'<%>',
149155
],
150156
{ any: true }
151157
);

0 commit comments

Comments
 (0)