Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: generate with pg_vector - migration produce misspelled string #2328

Open
vgauthier opened this issue May 15, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@vgauthier
Copy link

vgauthier commented May 15, 2024

What version of drizzle-orm are you using?

0.30.10

What version of drizzle-kit are you using?

No response

Describe the Bug

When using pg_vector extension the migration generate the following update.

ALTER TABLE "publications" ADD COLUMN "embedding" "vector(512)";

instead of

ALTER TABLE "publications" ADD COLUMN "embedding" vector(512); <= without quote on vector

produce the following error:

PostgresError: type "vector(512)" does not exist
    at ErrorResponse (/Users/vgauthier/Documents/TelecomSudParis/TravauxRecherche/Web/React/complexnet/node_modules/.pnpm/postgres@3.4.3/node_modules/postgres/cjs/src/connection.js:790:26)
    at handle (/Users/vgauthier/Documents/TelecomSudParis/TravauxRecherche/Web/React/complexnet/node_modules/.pnpm/postgres@3.4.3/node_modules/postgres/cjs/src/connection.js:476:6)
    at TLSSocket.data (/Users/vgauthier/Documents/TelecomSudParis/TravauxRecherche/Web/React/complexnet/node_modules/.pnpm/postgres@3.4.3/node_modules/postgres/cjs/src/connection.js:315:9)
    at TLSSocket.emit (node:events:518:28)
    at TLSSocket.emit (node:domain:488:12)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
  severity_local: 'ERROR',
  severity: 'ERROR',
  code: '42704',
  position: '51',
  file: 'parse_type.c',
  line: '270',
  routine: 'typenameType'
}

 pnpm run db:migrate

> complexnet@0.5 db:migrate /Users/vgauthier/Documents/TelecomSudParis/TravauxRecherche/Web/React/complexnet
> tsx src/db/migrate.ts

PostgresError: type "VECTOR(3)" does not exist
    at ErrorResponse (/Users/vgauthier/Documents/TelecomSudParis/TravauxRecherche/Web/React/complexnet/node_modules/.pnpm/postgres@3.4.3/node_modules/postgres/cjs/src/connection.js:790:26)
    at handle (/Users/vgauthier/Documents/TelecomSudParis/TravauxRecherche/Web/React/complexnet/node_modules/.pnpm/postgres@3.4.3/node_modules/postgres/cjs/src/connection.js:476:6)
    at TLSSocket.data (/Users/vgauthier/Documents/TelecomSudParis/TravauxRecherche/Web/React/complexnet/node_modules/.pnpm/postgres@3.4.3/node_modules/postgres/cjs/src/connection.js:315:9)
    at TLSSocket.emit (node:events:518:28)
    at TLSSocket.emit (node:domain:488:12)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
  severity_local: 'ERROR',
  severity: 'ERROR',
  code: '42704',
  position: '51',
  file: 'parse_type.c',
  line: '270',
  routine: 'typenameType'
}

Expected behavior

ALTER TABLE "publications" ADD COLUMN "embedding" vector(512);

Environment & setup

using pgvector-node https://github.com/pgvector/pgvector-node

@vgauthier vgauthier added the bug Something isn't working label May 15, 2024
@vgauthier vgauthier changed the title [BUG]: [BUG]: migration with pg_vector May 15, 2024
@vgauthier vgauthier changed the title [BUG]: migration with pg_vector [BUG]: generate pg_vector - migration produce wrong vector type string May 15, 2024
@vgauthier vgauthier changed the title [BUG]: generate pg_vector - migration produce wrong vector type string [BUG]: generate pg_vector - migration produce misspelled string May 15, 2024
@vgauthier vgauthier changed the title [BUG]: generate pg_vector - migration produce misspelled string [BUG]: generate with pg_vector - migration produce misspelled string May 15, 2024
@jackkweyunga
Copy link

I had to manually edit the file before migrating. Same happens with the push command.
@vgauthier how did you proceed ?

@vgauthier
Copy link
Author

vgauthier commented May 28, 2024

@jackkweyunga same as you, but I am not sure if the bug come from package Drizzle or pgvector-node package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants