Skip to content

Fix: Use sql.SQL() for pgvector access method names to fix "HNSW does not exist" error#762

Closed
NagarajuReddyBoggala wants to merge 1 commit intozilliztech:mainfrom
NagarajuReddyBoggala:fix/pgvector-hnsw-access-method
Closed

Fix: Use sql.SQL() for pgvector access method names to fix "HNSW does not exist" error#762
NagarajuReddyBoggala wants to merge 1 commit intozilliztech:mainfrom
NagarajuReddyBoggala:fix/pgvector-hnsw-access-method

Conversation

@NagarajuReddyBoggala
Copy link
Copy Markdown

Problem

PGVector HNSW index creation fails with:

  • "access method 'HNSW' does not exist"

This happens through the WebUI but works via CLI.

Root Cause

In pgvector.py lines 363 and 378, the index_type is wrapped with sql.Identifier(), which PostgreSQL treats as a quoted identifier. PostgreSQL access methods must NOT be quoted.

Solution

Changed sql.Identifier(index_param["index_type"]) to sql.SQL(index_param["index_type"])

This generates proper SQL:

  • Before: USING "hnsw"
  • After: USING hnsw

Fixes

Closes #759

- Changed index_type parameter from sql.Identifier to sql.SQL
- PostgreSQL access methods (hnsw, ivfflat) should not be quoted identifiers
- Fixes zilliztech#759: 'access method HNSW does not exist' error
@sre-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: NagarajuReddyBoggala
To complete the pull request process, please assign xuanyang-cn after the PR has been reviewed.
You can assign the PR to them by writing /assign @xuanyang-cn in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@NagarajuReddyBoggala
Copy link
Copy Markdown
Author

/assign @XuanYang-cn

@XuanYang-cn
Copy link
Copy Markdown
Collaborator

I think this is a dup with #760 and the #759 was fixed, I'm going to close this PR

@NagarajuReddyBoggala Thanks for the contribution again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Termial output: "access method 'HNSW' does not exist" Error

3 participants