I've used the same syntax I've found from 5 differ...
# help
j
I've used the same syntax I've found from 5 different places, so I'm not sure why this would be happening, but running the following SQL results in
db error: ERROR: malformed array literal: ""
Here's the SQL, anyone know why it would be causing this error?
Copy code
ALTER TABLE props ADD COLUMN textSearch tsvector GENERATED ALWAYS AS (
  setweight(to_tsvector('english', coalesce(name, "")), "A") ||
  setweight(to_tsvector('english', coalesce(terms,"")), "B")
) STORED;

CREATE INDEX props_textsearch_idx ON props USING GIN (textSearch);
n
Hello @JonWasTaken! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
g
try single quote ' instead of double "
n
JonWasTaken (2022-04-19)
j
Apologies, I pasted a version I was using for debugging - the actual query uses single quotes:
Copy code
ALTER TABLE props ADD COLUMN textSearch tsvector GENERATED ALWAYS AS (
  setweight(to_tsvector('english', coalesce(name, '')), 'A') ||
  setweight(to_tsvector('english', coalesce(terms,'')), 'B')
) STORED;
Full response from that:
Copy code
Error: P3006

Migration `20220419004549_add_full_text_search_to_prop` failed to apply cleanly to the shadow database. 
Error:
db error: ERROR: malformed array literal: ""
DETAIL: Array value must start with "{" or dimension information.
   0: sql_migration_connector::validate_migrations
             at migration-engine\connectors\sql-migration-connector\src\lib.rs:271
   1: migration_core::state::DevDiagnostic
             at migration-engine\core\src\state.rs:248
g
are you using prisma?
j
Yes, this is what happens when I run
npx prisma migrate dev
with that sql in the migration.sql file, but I tried using the supabase console directly and received the same error
g
Yeah, I'm not even going to try on Prisma stuff. You should in your question either here or in SQL highlight you are using Prisma. Hopefully someone using it has a better idea. I saw shadow database, I guessed... Prisma in general seems to work with Supabase, but issues come up with table/column names having upper case, double " being required, etc. Supabase itself is pure Postgres and any sql code you find should work. Sorry for backing out.
j
Wasn't aware that prisma complicate the sql error, that's interesting, thanks for the heads up