Open vanvilecks-not-dead opened 3 months ago
What version of drizzle-orm are you using? 0.32.2 What version of drizzle-kit are you using? 0.23.2
Describe the Bug I'm having the same issue even without adding new weights. It seems that the issue is not adding more weights but querying the schemas indexes while using weights. I've followed the guide https://orm.drizzle.team/learn/guides/postgresql-full-text-search
My table looks roughly like this.
export const items = pgTable(
'item',
{
id: uuid('id').defaultRandom().primaryKey(),
title: text('title'),
description: text('description'),
},
(table) => ({
searchIndex: index('item_search_index').using(
'gin',
sql`(
setweight(to_tsvector('english', ${table.title}), 'A') ||
setweight(to_tsvector('english', ${table.description}), 'B')
)`
),
})
);
I can run db:push
once but if I try to run it again even without changing anything on that index i get
error: malformed array literal: "{(setweight(to_tsvector('english'::regconfig, title), 'A'::"char") || setweight(to_tsvector('english'::regconfig, description), 'B'::"char"))}"
This happens while pulling the schema in the dbIndexes
query of pgSerializer.ts
in drizzle-kit
As @vanvilecks-not-dead already said the only workaround right now is to remove the index before every db:push
. Which is a major issue to me.
Environment & setup
Node.js: v21.7.0
pg: "8.12.0"
This is the problematic query https://github.com/drizzle-team/drizzle-orm/blob/7d2ae842da5e57ea161aa708ea567fb4afc4911c/drizzle-kit/src/serializer/pgSerializer.ts#L963C5-L963C11
Unfortunately I can't fix it myself because I'm bad at raw SQL
https://github.com/drizzle-team/drizzle-orm/issues/2744 could be related
same issue
any updates on this? i am having trouble too
It seems to me that the issue with drizzle-orm won’t be fixed this year, and patching it feels like a bad technical solution.
I'm kinda stressed by this not getting any attention but I guess there is only 2 choices. patching it locally until it is fixed or switching to prisma (which is no option for me).
since the big update is out now. maybe @AndriiSherman has some spare time to look into the PR 😏
Just ran into this myself.
Same error here.
What version of
drizzle-orm
are you using?0.31.2
What version of
drizzle-kit
are you using?0.20.18
Describe the Bug
While running the db:push command in our project, an error occurs due to a malformed array literal. The error traceback indicates that the issue arises within the drizzle-kit package, specifically in handling the array literal for setting weights to the text search vectors.
Code Example:
The following code works correctly:
However, adding more weights results in the error from the stack trace:
If revert to a working state with two weights and run db:push, the same error from the stack trace will occur.
The only solution that helped return to a working state is to completely remove the search index from the code and then run db:push.
stack trace:
Expected behavior
The db:push command should execute successfully without any errors related to array literals. It is expected that weights can be set for more than two fields.
Environment & setup