question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Postgres fulltext search - Cannot query tsvector column with $queryRaw

See original GitHub issue

Bug 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 typetsvector`

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:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Weakkycommented, Apr 4, 2022

Better documentation around Unsupported and query raw might be needed indeed! That being said, if having a tsvector as string is helpful in your case, nothing should prevent you from casting your column as text. This should bring you a similar behavior than node-postgres.

SELECT label::text FROM products
0reactions
Weakkycommented, May 6, 2022

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 🙏

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found