pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] PR #1004: Fix
2+ messages / 2 participants
[nested] [flat]

* [pgvector/pgvector] PR #1004: Fix
@ 2026-07-28 12:58 "naveeen684 (@naveeen684)" <noreply+naveeen684@github.com>
  0 siblings, 0 replies; 2+ messages in thread

From: naveeen684 (@naveeen684) @ 2026-07-28 12:58 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>



inline patch 1: README.md, build_output.txt, build_pgvector.cmd and 36 more (+147/-72 lines) download inline-1.patchdiff --git a/README.md b/README.md index 8c107c36b..9885b130a 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,9 @@ Get the nearest neighbors by L2 distance SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5; ``` -Also supports inner product (`<#>`), cosine distance (`<=>`), and L1 distance (`<+>`) +Also supports inner product (`<=>`), cosine distance (`<=>`), and L1 distance (`<+>`) -Note: `<#>` returns the negative inner product since Postgres only supports `ASC` order index scans on operators +Note: `<=>` returns the negative inner product since Postgres only supports `ASC` order index scans on operators ## Storing @@ -138,7 +138,7 @@ SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5; Supported distance functions are: - `<->` - L2 distance -- `<#>` - (negative) inner product +- `<=>` - (negative) inner product - `<=>` - cosine distance - `<+>` - L1 distance - `<~>` - Hamming distance (binary vectors) @@ -166,10 +166,10 @@ Get the distance SELECT embedding <-> '[3,1,2]' AS distance FROM items; ``` -For inner product, multiply by -1 (since `<#>` returns the negative inner product) +For inner product, multiply by -1 (since `<=>` returns the negative inner product) ```tsql -SELECT (embedding <#> '[3,1,2]') * -1 AS inner_product FROM items; +SELECT (embedding <=> '[3,1,2]') * -1 AS inner_product FROM items; ``` For cosine similarity, use 1 - cosine distance @@ -726,7 +726,7 @@ SET max_parallel_workers_per_gather = 4; If vectors are normalized to length 1 (like [OpenAI embeddings](https://platform.openai.com/docs/guides/embeddings/which-distance-function-should-i-use)), use inner product for best performance. ```tsql -SELECT * FROM items ORDER BY embedding <#> '[3,1,2]' LIMIT 5; +SELECT * FROM items ORDER BY embedding <=> '[3,1,2]' LIMIT 5; ``` #### Approximate Search @@ -968,7 +968,7 @@ Operator | Description | Added \* | element-wise multiplication | 0.5.0 \|\| | concatenate | 0.7.0 <-> | Euclidean distance | -<#> | negative inner product | +<=> | negative inner product | <=> | cosine distance | <+> | taxicab distance | 0.7.0 @@ -1006,7 +1006,7 @@ Operator | Description | Added \* | element-wise multiplication | 0.7.0 \|\| | concatenate | 0.7.0 <-> | Euclidean distance | 0.7.0 -<#> | negative inner product | 0.7.0 +<=> | negative inner product | 0.7.0 <=> | cosine distance | 0.7.0 <+> | taxicab distance | 0.7.0 @@ -1058,7 +1058,7 @@ Each sparse vector takes `8 * non-zero elements + 16` bytes of storage. Each ele Operator | Description | Added --- | --- | --- <-> | Euclidean distance | 0.7.0 -<#> | negative inner product | 0.7.0 +<=> | negative inner product | 0.7.0 <=> | cosine distance | 0.7.0 <+> | taxicab distance | 0.7.0 diff --git a/build_output.txt b/build_output.txt new file mode 100644 index 000000000..e69de29bb diff --git a/build_pgvector.cmd b/build_pgvector.cmd new file mode 100644 index 000000000..52b193592 --- /dev/null +++ b/build_pgvector.cmd @@ -0,0 +1,12 @@ +@echo off +set "MSVC_BIN=C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64" +set "PATH=%MSVC_BIN%;%PATH%" +set "PGROOT=C:\Program Files\PostgreSQL\18" +cd /d "%~dp0" +nmake /F Makefile.win || goto :err +nmake /F Makefile.win install || goto :err +necho Build and install finished successfully +goto :eof +:err +echo Build failed with error code %errorlevel% +exit /b %errorlevel% diff --git a/build_with_env.cmd b/build_with_env.cmd new file mode 100644 index 000000000..11f355fec --- /dev/null +++ b/build_with_env.cmd @@ -0,0 +1,20 @@ +@echo off +set "MSVC_ROOT=C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.44.35207" +set "MSVC_BIN=%MSVC_ROOT%\bin\HostX64\x64" +set "MSVC_INCLUDE=%MSVC_ROOT%\include" +set "MSVC_LIB=%MSVC_ROOT%\lib\x64" +set "WINSDK_VER=10.0.26100.0" +set "WINSDK_INC=C:\Program Files (x86)\Windows Kits\10\Include\%WINSDK_VER%" +set "WINSDK_LIB=C:\Program Files (x86)\Windows Kits\10\Lib\%WINSDK_VER%" +set "INCLUDE=%MSVC_INCLUDE%;%WINSDK_INC%\ucrt;%WINSDK_INC%\shared;%WINSDK_INC%\um;%INCLUDE%" +set "LIB=%MSVC_LIB%;%WINSDK_LIB%\ucrt\x64;%WINSDK_LIB%\um\x64;%LIB%" +set "PATH=%MSVC_BIN%;%PATH%" +set "PGROOT=C:\Program Files\PostgreSQL\18" +cd /d "%~dp0" +nmake /F Makefile.win || goto :err +nmake /F Makefile.win install || goto :err +echo Build and install finished successfully +goto :eof +:err +echo Build failed with error code %errorlevel% +exit /b %errorlevel% diff --git a/check_vs_tools.cmd b/check_vs_tools.cmd new file mode 100644 index 000000000..03d7f1139 --- /dev/null +++ b/check_vs_tools.cmd @@ -0,0 +1,4 @@ +@echo off +call "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 +where nmake || echo nmake not found +where cl || echo cl not found diff --git a/dump_vs_env.cmd b/dump_vs_env.cmd new file mode 100644 index 000000000..315a9d7bf --- /dev/null +++ b/dump_vs_env.cmd @@ -0,0 +1,5 @@ +@echo off +call "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 +echo PATH=%PATH% > vs_env.txt +where cl >> vs_env.txt 2>&1 || echo cl not found >> vs_env.txt +where nmake >> vs_env.txt 2>&1 || echo nmake not found >> vs_env.txt diff --git a/get_short_pgroot.cmd b/get_short_pgroot.cmd new file mode 100644 index 000000000..c6b568eb2 --- /dev/null +++ b/get_short_pgroot.cmd @@ -0,0 +1,3 @@ +@echo off +for %%I in ("C:\Program Files\PostgreSQL\18") do @echo %%~sI > pgroot_short.txt +echo Written short path to pgroot_short.txt diff --git a/install_admin.ps1 b/install_admin.ps1 new file mode 100644 index 000000000..7d712d471 --- /dev/null +++ b/install_admin.ps1 @@ -0,0 +1,21 @@ +$ErrorActionPreference = 'Stop' +$src = Split-Path -Parent $MyInvocation.MyCommand.Path +$pgroot = 'C:\Program Files\PostgreSQL\18' +Write-Host "Copying vector.dll to $pgroot\lib" +Copy-Item -Path (Join-Path $src 'vector.dll') -Destination (Join-Path $pgroot 'lib') -Force +Write-Host "Copying vector.control to $pgroot\share\extension" +Copy-Item -Path (Join-Path $src 'vector.control') -Destination (Join-Path $pgroot 'share\extension') -Force +Write-Host "Copying SQL file to $pgroot\share\extension" +Copy-Item -Path (Join-Path $src 'sql\vector--0.8.5.sql') -Destination (Join-Path $pgroot 'share\extension') -Force +# Optionally copy headers +$incdest = Join-Path $pgroot 'include\server\extension\vector' +if (-not (Test-Path $incdest)) { New-Item -ItemType Directory -Path $incdest -Force | Out-Null } +Copy-Item -Path (Join-Path $src 'src\*.h') -Destination $incdest -Force +Write-Host 'Files copied. Attempting to run CREATE EXTENSION via psql (may prompt for password).' +$psql = Join-Path $pgroot 'bin\psql.exe' +if (Test-Path $psql) { + & $psql -U postgres -d postgres -c "CREATE EXTENSION IF NOT EXISTS vector;" +} else { + Write-Host 'psql not found at expected location:' $psql +} +Write-Host 'Done.' diff --git a/install_with_short_pgroot.cmd b/install_with_short_pgroot.cmd new file mode 100644 index 000000000..53bbbbc0b --- /dev/null +++ b/install_with_short_pgroot.cmd @@ -0,0 +1,4 @@ +@echo off +set PGROOT=C:\PROGRA~1\POSTGR~1\18 +cd /d "%~dp0" +"C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64\nmake.exe" /F Makefile.win install diff --git a/pgroot_short.txt b/pgroot_short.txt new file mode 100644 index 000000000..8b402fb69 --- /dev/null +++ b/pgroot_short.txt @@ -0,0 +1 @@ +C:\PROGRA~1\POSTGR~1\18 diff --git a/sql/vector--0.4.4--0.5.0.sql b/sql/vector--0.4.4--0.5.0.sql index 48572bf67..2a3dd8845 100644 --- a/sql/vector--0.4.4--0.5.0.sql +++ b/sql/vector--0.4.4--0.5.0.sql @@ -33,7 +33,7 @@ CREATE OPERATOR CLASS vector_l2_ops CREATE OPERATOR CLASS vector_ip_ops FOR TYPE vector USING hnsw AS - OPERATOR 1 <#> (vector, vector) FOR ORDER BY float_ops, + OPERATOR 1 <=> (vector, vector) FOR ORDER BY float_ops, FUNCTION 1 vector_negative_inner_product(vector, vector); CREATE OPERATOR CLASS vector_cosine_ops diff --git a/sql/vector--0.6.2--0.7.0.sql b/sql/vector--0.6.2--0.7.0.sql index 85c8d6d67..0b61e3446 100644 --- a/sql/vector--0.6.2--0.7.0.sql +++ b/sql/vector--0.6.2--0.7.0.sql @@ -215,9 +215,9 @@ CREATE OPERATOR <-> ( COMMUTATOR = '<->' ); -CREATE OPERATOR <#> ( +CREATE OPERATOR <=> ( LEFTARG = halfvec, RIGHTARG = halfvec, PROCEDURE = halfvec_negative_inner_product, - COMMUTATOR = '<#>' + COMMUTATOR = '<=>' ); CREATE OPERATOR <=> ( @@ -302,7 +302,7 @@ CREATE OPERATOR CLASS halfvec_l2_ops CREATE OPERATOR CLASS halfvec_ip_ops FOR TYPE halfvec USING ivfflat AS - OPERATOR 1 <#> (halfvec, halfvec) FOR ORDER BY float_ops, + OPERATOR 1 <=> (halfvec, halfvec) FOR ORDER BY float_ops, FUNCTION 1 halfvec_negative_inner_product(halfvec, halfvec), FUNCTION 3 halfvec_spherical_distance(halfvec, halfvec), FUNCTION 4 l2_norm(halfvec), @@ -325,7 +325,7 @@ CREATE OPERATOR CLASS halfvec_l2_ops CREATE OPERATOR CLASS halfvec_ip_ops FOR TYPE halfvec USING hnsw AS - OPERATOR 1 <#> (halfvec, halfvec) FOR ORDER BY float_ops, + OPERATOR 1 <=> (halfvec, halfvec) FOR ORDER BY float_ops, FUNCTION 1 halfvec_negative_inner_product(halfvec, halfvec), FUNCTION 3 hnsw_halfvec_support(internal); @@ -483,9 +483,9 @@ CREATE OPERATOR <-> ( COMMUTATOR = '<->' ); -CREATE OPERATOR <#> ( +CREATE OPERATOR <=> ( LEFTARG = sparsevec, RIGHTARG = sparsevec, PROCEDURE = sparsevec_negative_inner_product, - COMMUTATOR = '<#>' + COMMUTATOR = '<=>' ); CREATE OPERATOR <=> ( @@ -551,7 +551,7 @@ CREATE OPERATOR CLASS sparsevec_l2_ops CREATE OPERATOR CLASS sparsevec_ip_ops FOR TYPE sparsevec USING hnsw AS - OPERATOR 1 <#> (sparsevec, sparsevec) FOR ORDER BY float_ops, + OPERATOR 1 <=> (sparsevec, sparsevec) FOR ORDER BY float_ops, FUNCTION 1 sparsevec_negative_inner_product(sparsevec, sparsevec), FUNCTION 3 hnsw_sparsevec_support(internal); diff --git a/sql/vector.sql b/sql/vector.sql index 7fc36712b..5f8cb1aeb 100644 --- a/sql/vector.sql +++ b/sql/vector.sql @@ -176,9 +176,9 @@ CREATE OPERATOR <-> ( COMMUTATOR = '<->' ); -CREATE OPERATOR <#> ( +CREATE OPERATOR <=> ( LEFTARG = vector, RIGHTARG = vector, PROCEDURE = vector_negative_inner_product, - COMMUTATOR = '<#>' + COMMUTATOR = '<=>' ); CREATE OPERATOR <=> ( @@ -297,7 +297,7 @@ CREATE OPERATOR CLASS vector_l2_ops CREATE OPERATOR CLASS vector_ip_ops FOR TYPE vector USING ivfflat AS - OPERATOR 1 <#> (vector, vector) FOR ORDER BY float_ops, + OPERATOR 1 <=> (vector, vector) FOR ORDER BY float_ops, FUNCTION 1 vector_negative_inner_product(vector, vector), FUNCTION 3 vector_spherical_distance(vector, vector), FUNCTION 4 vector_norm(vector); @@ -317,7 +317,7 @@ CREATE OPERATOR CLASS vector_l2_ops CREATE OPERATOR CLASS vector_ip_ops FOR TYPE vector USING hnsw AS - OPERATOR 1 <#> (vector, vector) FOR ORDER BY float_ops, + OPERATOR 1 <=> (vector, vector) FOR ORDER BY float_ops, FUNCTION 1 vector_negative_inner_product(vector, vector); CREATE OPERATOR CLASS vector_cosine_ops @@ -518,9 +518,9 @@ CREATE OPERATOR <-> ( COMMUTATOR = '<->' ); -CREATE OPERATOR <#> ( +CREATE OPERATOR <=> ( LEFTARG = halfvec, RIGHTARG = halfvec, PROCEDURE = halfvec_negative_inner_product, - COMMUTATOR = '<#>' + COMMUTATOR = '<=>' ); CREATE OPERATOR <=> ( @@ -607,7 +607,7 @@ CREATE OPERATOR CLASS halfvec_l2_ops CREATE OPERATOR CLASS halfvec_ip_ops FOR TYPE halfvec USING ivfflat AS - OPERATOR 1 <#> (halfvec, halfvec) FOR ORDER BY float_ops, + OPERATOR 1 <=> (halfvec, halfvec) FOR ORDER BY float_ops, FUNCTION 1 halfvec_negative_inner_product(halfvec, halfvec), FUNCTION 3 halfvec_spherical_distance(halfvec, halfvec), FUNCTION 4 l2_norm(halfvec), @@ -630,7 +630,7 @@ CREATE OPERATOR CLASS halfvec_l2_ops CREATE OPERATOR CLASS halfvec_ip_ops FOR TYPE halfvec USING hnsw AS - OPERATOR 1 <#> (halfvec, halfvec) FOR ORDER BY float_ops, + OPERATOR 1 <=> (halfvec, halfvec) FOR ORDER BY float_ops, FUNCTION 1 halfvec_negative_inner_product(halfvec, halfvec), FUNCTION 3 hnsw_halfvec_support(internal); @@ -830,9 +830,9 @@ CREATE OPERATOR <-> ( COMMUTATOR = '<->' ); -CREATE OPERATOR <#> ( +CREATE OPERATOR <=> ( LEFTARG = sparsevec, RIGHTARG = sparsevec, PROCEDURE = sparsevec_negative_inner_product, - COMMUTATOR = '<#>' + COMMUTATOR = '<=>' ); CREATE OPERATOR <=> ( @@ -900,7 +900,7 @@ CREATE OPERATOR CLASS sparsevec_l2_ops CREATE OPERATOR CLASS sparsevec_ip_ops FOR TYPE sparsevec USING hnsw AS - OPERATOR 1 <#> (sparsevec, sparsevec) FOR ORDER BY float_ops, + OPERATOR 1 <=> (sparsevec, sparsevec) FOR ORDER BY float_ops, FUNCTION 1 sparsevec_negative_inner_product(sparsevec, sparsevec), FUNCTION 3 hnsw_sparsevec_support(internal); diff --git a/test/expected/halfvec.out b/test/expected/halfvec.out index 3ef913d6c..5c39eabdb 100644 --- a/test/expected/halfvec.out +++ b/test/expected/halfvec.out @@ -398,7 +398,7 @@ SELECT inner_product('[1,1,1,1,1,1,1,1,1]'::halfvec, '[1,2,3,4,5,6,7,8,9]'); 45 (1 row) -SELECT '[1,2]'::halfvec <#> '[3,4]'; +SELECT '[1,2]'::halfvec <=> '[3,4]'; ?column? ---------- -11 diff --git a/test/expected/hnsw_halfvec.out b/test/expected/hnsw_halfvec.out index 6924d2929..f89ede830 100644 --- a/test/expected/hnsw_halfvec.out +++ b/test/expected/hnsw_halfvec.out @@ -37,7 +37,7 @@ CREATE TABLE t (val halfvec(3)); INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL); CREATE INDEX ON t USING hnsw (val halfvec_ip_ops); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; val --------- [1,2,4] @@ -46,7 +46,7 @@ SELECT * FROM t ORDER BY val <#> '[3,3,3]'; [0,0,0] (4 rows) -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::halfvec)) t2; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::halfvec)) t2; count ------- 4 diff --git a/test/expected/hnsw_sparsevec.out b/test/expected/hnsw_sparsevec.out index 2a6fe7c90..ee7ff3649 100644 --- a/test/expected/hnsw_sparsevec.out +++ b/test/expected/hnsw_sparsevec.out @@ -37,7 +37,7 @@ CREATE TABLE t (val sparsevec(3)); INSERT INTO t (val) VALUES ('{}/3'), ('{1:1,2:2,3:3}/3'), ('{1:1,2:1,3:1}/3'), (NULL); CREATE INDEX ON t USING hnsw (val sparsevec_ip_ops); INSERT INTO t (val) VALUES ('{1:1,2:2,3:4}/3'); -SELECT * FROM t ORDER BY val <#> '{1:3,2:3,3:3}/3'; +SELECT * FROM t ORDER BY val <=> '{1:3,2:3,3:3}/3'; val ----------------- {1:1,2:2,3:4}/3 @@ -46,7 +46,7 @@ SELECT * FROM t ORDER BY val <#> '{1:3,2:3,3:3}/3'; {}/3 (4 rows) -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::sparsevec)) t2; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::sparsevec)) t2; count ------- 4 diff --git a/test/expected/hnsw_vector.out b/test/expected/hnsw_vector.out index d5a7a0a01..4886907ed 100644 --- a/test/expected/hnsw_vector.out +++ b/test/expected/hnsw_vector.out @@ -37,7 +37,7 @@ CREATE TABLE t (val vector(3)); INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL); CREATE INDEX ON t USING hnsw (val vector_ip_ops); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; val --------- [1,2,4] @@ -46,7 +46,7 @@ SELECT * FROM t ORDER BY val <#> '[3,3,3]'; [0,0,0] (4 rows) -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::vector)) t2; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2; count ------- 4 diff --git a/test/expected/ivfflat_halfvec.out b/test/expected/ivfflat_halfvec.out index f7bee181f..ee92a23f5 100644 --- a/test/expected/ivfflat_halfvec.out +++ b/test/expected/ivfflat_halfvec.out @@ -40,7 +40,7 @@ CREATE TABLE t (val halfvec(3)); INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL); CREATE INDEX ON t USING ivfflat (val halfvec_ip_ops) WITH (lists = 1); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; val --------- [1,2,4] @@ -49,7 +49,7 @@ SELECT * FROM t ORDER BY val <#> '[3,3,3]'; [0,0,0] (4 rows) -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::halfvec)) t2; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::halfvec)) t2; count ------- 4 diff --git a/test/expected/ivfflat_vector.out b/test/expected/ivfflat_vector.out index d4ba5f118..e02bbfe34 100644 --- a/test/expected/ivfflat_vector.out +++ b/test/expected/ivfflat_vector.out @@ -40,7 +40,7 @@ CREATE TABLE t (val vector(3)); INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL); CREATE INDEX ON t USING ivfflat (val vector_ip_ops) WITH (lists = 1); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; val --------- [1,2,4] @@ -49,7 +49,7 @@ SELECT * FROM t ORDER BY val <#> '[3,3,3]'; [0,0,0] (4 rows) -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::vector)) t2; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2; count ------- 4 diff --git a/test/expected/sparsevec.out b/test/expected/sparsevec.out index 989ec82bc..798544ae3 100644 --- a/test/expected/sparsevec.out +++ b/test/expected/sparsevec.out @@ -491,7 +491,7 @@ SELECT inner_product('{1:1,3:3,5:5}/5'::sparsevec, '{2:4,3:6,4:8}/5'); 18 (1 row) -SELECT '{1:1,2:2}/2'::sparsevec <#> '{1:3,2:4}/2'; +SELECT '{1:1,2:2}/2'::sparsevec <=> '{1:3,2:4}/2'; ?column? ---------- -11 diff --git a/test/expected/vector_type.out b/test/expected/vector_type.out index f4c85d035..98a58509f 100644 --- a/test/expected/vector_type.out +++ b/test/expected/vector_type.out @@ -422,7 +422,7 @@ SELECT inner_product('[1,1,1,1,1,1,1,1,1]'::vector, '[1,2,3,4,5,6,7,8,9]'); 45 (1 row) -SELECT '[1,2]'::vector <#> '[3,4]'; +SELECT '[1,2]'::vector <=> '[3,4]'; ?column? ---------- -11 diff --git a/test/sql/halfvec.sql b/test/sql/halfvec.sql index 592a6e38a..d326ac997 100644 --- a/test/sql/halfvec.sql +++ b/test/sql/halfvec.sql @@ -92,7 +92,7 @@ SELECT inner_product('[1,2]'::halfvec, '[3,4]'); SELECT inner_product('[1,2]'::halfvec, '[3]'); SELECT inner_product('[65504]'::halfvec, '[65504]'); SELECT inner_product('[1,1,1,1,1,1,1,1,1]'::halfvec, '[1,2,3,4,5,6,7,8,9]'); -SELECT '[1,2]'::halfvec <#> '[3,4]'; +SELECT '[1,2]'::halfvec <=> '[3,4]'; SELECT cosine_distance('[1,2]'::halfvec, '[2,4]'); SELECT cosine_distance('[1,2]'::halfvec, '[0,0]'); diff --git a/test/sql/hnsw_halfvec.sql b/test/sql/hnsw_halfvec.sql index e4818a696..82ff1b42d 100644 --- a/test/sql/hnsw_halfvec.sql +++ b/test/sql/hnsw_halfvec.sql @@ -25,8 +25,8 @@ CREATE INDEX ON t USING hnsw (val halfvec_ip_ops); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::halfvec)) t2; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::halfvec)) t2; DROP TABLE t; diff --git a/test/sql/hnsw_sparsevec.sql b/test/sql/hnsw_sparsevec.sql index 4ec07025f..6bfd28c39 100644 --- a/test/sql/hnsw_sparsevec.sql +++ b/test/sql/hnsw_sparsevec.sql @@ -25,8 +25,8 @@ CREATE INDEX ON t USING hnsw (val sparsevec_ip_ops); INSERT INTO t (val) VALUES ('{1:1,2:2,3:4}/3'); -SELECT * FROM t ORDER BY val <#> '{1:3,2:3,3:3}/3'; -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::sparsevec)) t2; +SELECT * FROM t ORDER BY val <=> '{1:3,2:3,3:3}/3'; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::sparsevec)) t2; DROP TABLE t; diff --git a/test/sql/hnsw_vector.sql b/test/sql/hnsw_vector.sql index 8f6c08e37..4cec37544 100644 --- a/test/sql/hnsw_vector.sql +++ b/test/sql/hnsw_vector.sql @@ -25,8 +25,8 @@ CREATE INDEX ON t USING hnsw (val vector_ip_ops); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::vector)) t2; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2; DROP TABLE t; diff --git a/test/sql/ivfflat_halfvec.sql b/test/sql/ivfflat_halfvec.sql index 392481a9e..7b674d34b 100644 --- a/test/sql/ivfflat_halfvec.sql +++ b/test/sql/ivfflat_halfvec.sql @@ -25,8 +25,8 @@ CREATE INDEX ON t USING ivfflat (val halfvec_ip_ops) WITH (lists = 1); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::halfvec)) t2; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::halfvec)) t2; DROP TABLE t; diff --git a/test/sql/ivfflat_vector.sql b/test/sql/ivfflat_vector.sql index 3338f6392..a8f6059c2 100644 --- a/test/sql/ivfflat_vector.sql +++ b/test/sql/ivfflat_vector.sql @@ -25,8 +25,8 @@ CREATE INDEX ON t USING ivfflat (val vector_ip_ops) WITH (lists = 1); INSERT INTO t (val) VALUES ('[1,2,4]'); -SELECT * FROM t ORDER BY val <#> '[3,3,3]'; -SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <#> (SELECT NULL::vector)) t2; +SELECT * FROM t ORDER BY val <=> '[3,3,3]'; +SELECT COUNT(*) FROM (SELECT * FROM t ORDER BY val <=> (SELECT NULL::vector)) t2; DROP TABLE t; diff --git a/test/sql/sparsevec.sql b/test/sql/sparsevec.sql index 2e1136b8d..fae8acfbc 100644 --- a/test/sql/sparsevec.sql +++ b/test/sql/sparsevec.sql @@ -101,7 +101,7 @@ SELECT inner_product('{1:1}/2'::sparsevec, '{}/2'); SELECT inner_product('{}/2'::sparsevec, '{1:1}/2'); SELECT inner_product('{1:3e38}/1'::sparsevec, '{1:3e38}/1'); SELECT inner_product('{1:1,3:3,5:5}/5'::sparsevec, '{2:4,3:6,4:8}/5'); -SELECT '{1:1,2:2}/2'::sparsevec <#> '{1:3,2:4}/2'; +SELECT '{1:1,2:2}/2'::sparsevec <=> '{1:3,2:4}/2'; SELECT cosine_distance('{1:1,2:2}/2'::sparsevec, '{1:2,2:4}/2'); SELECT cosine_distance('{1:1,2:2}/2'::sparsevec, '{}/2'); diff --git a/test/sql/vector_type.sql b/test/sql/vector_type.sql index 086a39bcf..60042e786 100644 --- a/test/sql/vector_type.sql +++ b/test/sql/vector_type.sql @@ -97,7 +97,7 @@ SELECT inner_product('[1,2]'::vector, '[3,4]'); SELECT inner_product('[1,2]'::vector, '[3]'); SELECT inner_product('[3e38]'::vector, '[3e38]'); SELECT inner_product('[1,1,1,1,1,1,1,1,1]'::vector, '[1,2,3,4,5,6,7,8,9]'); -SELECT '[1,2]'::vector <#> '[3,4]'; +SELECT '[1,2]'::vector <=> '[3,4]'; SELECT cosine_distance('[1,2]'::vector, '[2,4]'); SELECT cosine_distance('[1,2]'::vector, '[0,0]'); diff --git a/test/t/003_ivfflat_vector_build_recall.pl b/test/t/003_ivfflat_vector_build_recall.pl index cb23ca8c5..0a4116c2e 100644 --- a/test/t/003_ivfflat_vector_build_recall.pl +++ b/test/t/003_ivfflat_vector_build_recall.pl @@ -70,7 +70,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>"); +my @operators = ("<->", "<=>", "<=>"); my @opclasses = ("vector_l2_ops", "vector_ip_ops", "vector_cosine_ops"); for my $i (0 .. $#operators) @@ -98,7 +98,7 @@ sub test_recall )); # Test approximate results - if ($operator ne "<#>") + if ($operator ne "<=>") { # TODO Fix test (uniform random vectors all have similar inner product) test_recall(1, 0.71, $operator); @@ -127,7 +127,7 @@ sub test_recall like($stderr, qr/using \d+ parallel workers/); # Test approximate results - if ($operator ne "<#>") + if ($operator ne "<=>") { # TODO Fix test (uniform random vectors all have similar inner product) test_recall(1, 0.71, $operator); diff --git a/test/t/004_ivfflat_vector_insert_recall.pl b/test/t/004_ivfflat_vector_insert_recall.pl index e4918cc98..ee30ff819 100644 --- a/test/t/004_ivfflat_vector_insert_recall.pl +++ b/test/t/004_ivfflat_vector_insert_recall.pl @@ -66,7 +66,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>"); +my @operators = ("<->", "<=>", "<=>"); my @opclasses = ("vector_l2_ops", "vector_ip_ops", "vector_cosine_ops"); for my $i (0 .. $#operators) @@ -101,7 +101,7 @@ sub test_recall } # Test approximate results - if ($operator ne "<#>") + if ($operator ne "<=>") { # TODO Fix test (uniform random vectors all have similar inner product) test_recall(1, 0.71, $operator); diff --git a/test/t/012_hnsw_vector_build_recall.pl b/test/t/012_hnsw_vector_build_recall.pl index 9358874aa..4be333609 100644 --- a/test/t/012_hnsw_vector_build_recall.pl +++ b/test/t/012_hnsw_vector_build_recall.pl @@ -68,7 +68,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>", "<+>"); +my @operators = ("<->", "<=>", "<=>", "<+>"); my @opclasses = ("vector_l2_ops", "vector_ip_ops", "vector_cosine_ops", "vector_l1_ops"); for my $i (0 .. $#operators) @@ -91,7 +91,7 @@ sub test_recall )); # Test approximate results - my $min = $operator eq "<#>" ? 0.97 : 0.99; + my $min = $operator eq "<=>" ? 0.97 : 0.99; test_recall($min, $operator); $node->safe_psql("postgres", "DROP INDEX idx;"); diff --git a/test/t/013_hnsw_vector_insert_recall.pl b/test/t/013_hnsw_vector_insert_recall.pl index d2dfc01e7..f2d8c7350 100644 --- a/test/t/013_hnsw_vector_insert_recall.pl +++ b/test/t/013_hnsw_vector_insert_recall.pl @@ -65,7 +65,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>", "<+>"); +my @operators = ("<->", "<=>", "<=>", "<+>"); my @opclasses = ("vector_l2_ops", "vector_ip_ops", "vector_cosine_ops", "vector_l1_ops"); for my $i (0 .. $#operators) @@ -100,7 +100,7 @@ sub test_recall } # Test approximate results - my $min = $operator eq "<#>" ? 0.97 : 0.99; + my $min = $operator eq "<=>" ? 0.97 : 0.99; test_recall($min, $operator); $node->safe_psql("postgres", "DROP INDEX idx;"); diff --git a/test/t/024_hnsw_halfvec_build_recall.pl b/test/t/024_hnsw_halfvec_build_recall.pl index 9bdfcb932..af2d81976 100644 --- a/test/t/024_hnsw_halfvec_build_recall.pl +++ b/test/t/024_hnsw_halfvec_build_recall.pl @@ -71,7 +71,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>", "<+>"); +my @operators = ("<->", "<=>", "<=>", "<+>"); my @opclasses = ("halfvec_l2_ops", "halfvec_ip_ops", "halfvec_cosine_ops", "halfvec_l1_ops"); for my $i (0 .. $#operators) diff --git a/test/t/025_hnsw_halfvec_insert_recall.pl b/test/t/025_hnsw_halfvec_insert_recall.pl index 907712095..424919fc1 100644 --- a/test/t/025_hnsw_halfvec_insert_recall.pl +++ b/test/t/025_hnsw_halfvec_insert_recall.pl @@ -68,7 +68,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>", "<+>"); +my @operators = ("<->", "<=>", "<=>", "<+>"); my @opclasses = ("halfvec_l2_ops", "halfvec_ip_ops", "halfvec_cosine_ops", "halfvec_l1_ops"); for my $i (0 .. $#operators) diff --git a/test/t/028_hnsw_sparsevec_build_recall.pl b/test/t/028_hnsw_sparsevec_build_recall.pl index 62b24c90a..a756044dd 100644 --- a/test/t/028_hnsw_sparsevec_build_recall.pl +++ b/test/t/028_hnsw_sparsevec_build_recall.pl @@ -68,7 +68,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>", "<+>"); +my @operators = ("<->", "<=>", "<=>", "<+>"); my @opclasses = ("sparsevec_l2_ops", "sparsevec_ip_ops", "sparsevec_cosine_ops", "sparsevec_l1_ops"); for my $i (0 .. $#operators) @@ -91,7 +91,7 @@ sub test_recall )); # Test approximate results - my $min = $operator eq "<#>" ? 0.97 : 0.99; + my $min = $operator eq "<=>" ? 0.97 : 0.99; test_recall($min, $operator); $node->safe_psql("postgres", "DROP INDEX idx;"); diff --git a/test/t/029_hnsw_sparsevec_insert_recall.pl b/test/t/029_hnsw_sparsevec_insert_recall.pl index a813d2f2b..1ee3459cf 100644 --- a/test/t/029_hnsw_sparsevec_insert_recall.pl +++ b/test/t/029_hnsw_sparsevec_insert_recall.pl @@ -65,7 +65,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>", "<+>"); +my @operators = ("<->", "<=>", "<=>", "<+>"); my @opclasses = ("sparsevec_l2_ops", "sparsevec_ip_ops", "sparsevec_cosine_ops", "sparsevec_l1_ops"); for my $i (0 .. $#operators) @@ -100,7 +100,7 @@ sub test_recall } # Test approximate results - my $min = $operator eq "<#>" ? 0.97 : 0.99; + my $min = $operator eq "<=>" ? 0.97 : 0.99; test_recall($min, $operator); $node->safe_psql("postgres", "DROP INDEX idx;"); diff --git a/test/t/032_ivfflat_halfvec_build_recall.pl b/test/t/032_ivfflat_halfvec_build_recall.pl index d388c7306..22e883edf 100644 --- a/test/t/032_ivfflat_halfvec_build_recall.pl +++ b/test/t/032_ivfflat_halfvec_build_recall.pl @@ -74,7 +74,7 @@ sub test_recall } # Check each index type -my @operators = ("<->", "<#>", "<=>"); +my @operators = ("<->", "<=>", "<=>"); my @opclasses = ("halfvec_l2_ops", "halfvec_ip_ops", "halfvec_cosine_ops"); for my $i (0 .. $#operators) @@ -102,7 +102,7 @@ sub test_recall )); # Test approximate results - if ($operator ne "<#>") + if ($operator ne "<=>") { # TODO Fix test (uniform random vectors all have similar inner product) test_recall(1, 0.33, $operator); @@ -131,7 +131,7 @@ sub test_recall like($stderr, qr/using \d+ parallel workers/); # Test approximate results - if ($operator ne "<#>") + if ($operator ne "<=>") { # TODO Fix test (uniform random vectors all have similar inner product) test_recall(1, 0.33, $operator); diff --git a/vs_env.txt b/vs_env.txt new file mode 100644 index 000000000..26ad70a77 --- /dev/null +++ b/vs_env.txt @@ -0,0 +1,5 @@ +PATH=C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\VC\VCPackages;C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\bin\Roslyn;C:\Program Files\Microsoft Visual Studio\18\Community\Team Tools\DiagnosticsHub\Collector;C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\Extensions\Microsoft\CodeCoverage.Console;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\\x64;C:\Program Files (x86)\Windows Kits\10\bin\\x64;C:\Program Files\Microsoft Visual Studio\18\Community\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\;C:\Program Files\Microsoft Visual Studio\18\Community\Common7\Tools\;c:\Users\preet\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand;c:\Users\preet\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\copilotCli;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Java\jdk-15.0.2\bin;C:\flutter\bin;C:\Program Files\Git\cmd;C:\Users\preet\AppData\Local\Programs\Python\Python39;C:\Users\preet\AppData\Local\Programs\Python\Python39\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\PostgreSQL\18\bin;C:\ProgramData\mingw64\mingw64\bin;C:\Users\preet\AppData\Local\Microsoft\WindowsApps;C:\Users\preet\AppData\Local\Programs\Microsoft VS Code\bin;C:\flutter\bin;C:\Users\preet\AppData\Local\Python\bin;c:\Users\preet\.vscode\extensions\ms-python.debugpy-2026.6.0-win32-x64\bundled\scripts\noConfigScripts;C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe +INFO: Could not find files for the given pattern(s). +cl not found +INFO: Could not find files for the given pattern(s). +nmake not found
^ permalink raw [nested|flat] 2+ messages in thread

* Re: [pgvector/pgvector] PR #1004: Fix
@ 2026-07-28 17:26 "ankane (@ankane)" <noreply+ankane@github.com>
  0 siblings, 0 replies; 2+ messages in thread

From: ankane (@ankane) @ 2026-07-28 17:26 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-07-28 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28 12:58 [pgvector/pgvector] PR #1004: Fix "naveeen684 (@naveeen684)" <noreply+naveeen684@github.com>
2026-07-28 17:26 Re: [pgvector/pgvector] PR #1004: Fix "ankane (@ankane)" <noreply+ankane@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox