Skip to content

pgvector WithEmbeddingTableName sanitization conflicts with index creation  #605

@rajaiswal

Description

@rajaiswal

When I initialize pgvector like this:

pgv, err := pgvector.New(
                ...
		pgvector.WithEmbeddingTableName("custom_name"),
	)

The WithEmbeddingTableName sanitizes the input and its value becomes "\"custom_name\"", which is set on Store.embeddingTableName.
This then raises an error when the init method is called and it tries to create an index:

sql = fmt.Sprintf(`CREATE INDEX IF NOT EXISTS %s_collection_id ON %s (collection_id)`, s.embeddingTableName, s.embeddingTableName)

The generated error is:

ERROR: syntax error at or near "_collection_id" (SQLSTATE 42601)

I believe we could do away with the sanitization part in WithEmbeddingTableName

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions