Postgres fulltext search - Cannot query tsvector column with $queryRaw
See original GitHub issueBug description
Raw query failed. Code: N/A
. Message: error deserializing column 7: cannot convert between the Rust type
core::option::Optionalloc::string::Stringand the Postgres type
tsvector`
How to reproduce
const res =
await prisma.$queryRaw`SELECT * from products where label @@ to_tsquery(${search})`;
console.log(res);
Expected behavior
should work
Prisma information
label Unsupported("tsvector")? @default(dbgenerated("''::tsvector"))
Environment & setup
- OS: Mac
- Database: PostgreSQL
- Node.js version: 16
Prisma Version
3.10
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Documentation: 15: 12.3. Controlling Text Search - PostgreSQL
To implement full text searching there must be a function to create a tsvector from a document and a tsquery from a user...
Read more >PostgreSQL: full text search not working as intended
Another problem is that when i search for the word 'foxes' pgadmin returns False, while in the tutorial it returns true. SELECT to_tsvector('The ......
Read more >How to implement Full Text Search in Prisma with PostgreSQL?
First, we need to add a textSearch column with type TSVECTOR to the Post model, which will be used for a weighed full...
Read more >Understanding PostgreSQL Full Text Search: 10 Critical Aspects
ALTER TABLE se_details ADD COLUMN ts tsvector GENERATED ALWAYS AS (to_tsvector('english', event_narrative)) STORED;. In the new versions of ...
Read more >Seek and ye shall find: full-text search in PostgreSQL
Create a tsvector index on the text column of interest (content):. CREATE INDEX ON lunews.issues USING GIN (to_tsvector(content));.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Better documentation around
Unsupported
and query raw might be needed indeed! That being said, if having atsvector
asstring
is helpful in your case, nothing should prevent you from casting your column astext
. This should bring you a similar behavior thannode-postgres
.Hey @joshribakoff-sm,
I’m closing your issue in favor of #13203 as it’s not technically a bug + we had several duplicates. This issue explains the available workarounds and proposes solutions.
Thanks for reporting 🙏