Skip to content

Commit 2b36e4e

Browse files
committed
Support pgvector operators
Fixes #122
1 parent 88e6827 commit 2b36e4e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/parser.pegjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7494,6 +7494,8 @@ pg_other_op
74947494
= op:(
74957495
// multi-letter operators (non-exhaustive list)
74967496
"||/" / "|/" / "||" / ">>" / "<<" / "!~~*" / "~~*" / "!~~" / "~~" / "!~*" / "~*" / "!~" / "^@"
7497+
// pgvector operators
7498+
/ "<+>" / "<->" / "<#>" / "<=>" / "<~>" / "<%>"
74977499
// JSON operators
74987500
/ "->>" / "->" / "#>>" / "#>"
74997501
// JSONB operators

test/expr/op_postgres.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ describe("special PostgreSQL operators", () => {
3636
"#-",
3737
"@?",
3838
"@@",
39+
// pgvector
40+
// https://github.com/pgvector/pgvector#vector-operators
41+
"<+>",
42+
"<->",
43+
"<#>",
44+
"<=>",
45+
"<~>",
46+
"<%>",
3947
].forEach((op) => {
4048
it(`parses ${op} operator`, () => {
4149
testExprWc(`x ${op} y`);

0 commit comments

Comments
 (0)