-
Notifications
You must be signed in to change notification settings - Fork 925
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Version
1.26.0
What happened?
When using sqlc.narg with a PgVector parameter a regular PgVector is returned. This causes a bug as you can't pass nil or an empty array to PgVector, you get the following error from postgres: "vector must have at least 1 dimension" see the related c code:
https://github.com/pgvector/pgvector/blob/master/src/vector.c
I'm not sure if this is a bug that should be fixed here, or upstream in the pg vector golang library.
Relevant log output
No response
Database schema
CREATE TABLE IF NOT EXISTS client_portal.public.glossary (
id SERIAL primary key,
org_id uuid NOT NULL,
user_id uuid NOT NULL,
term varchar NOT NULL,
definition varchar NOT NULL,
tags varchar,
term_embedding vector(1024),
tags_query tsquery,
created_date timestamp DEFAULT (now() at time zone 'utc'),
updated_date timestamp DEFAULT (now() at time zone 'utc'),
UNIQUE(org_id, user_id, term)
);
SQL queries
-- name: InsertGlossaryEntry :one
INSERT INTO glossary (
org_id,
user_id,
term,
term_embedding,
definition,
tags,
tags_query)
VALUES ($1, $2, $3, $4, $5, $6, to_tsquery('english', $7))
RETURNING id;
Configuration
version: "2"
sql:
- engine: "postgresql"
queries: "/pkg/dal/queries/"
schema: "migrations/"
gen:
go:
package: "dal"
out: "pkg/dal/sqlc"
sql_package: "pgx/v5"
Playground URL
https://play.sqlc.dev/p/810eb3df11f9df1f0b3fe5d41a9402bd8421ee3def68f49f45c27402331bbe2f
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working