Skip to content

Tag: string

How to escape it properly?

I have sql string written with template string syntax: I have problems with binding second param – $2 because of single quote. How should I write it properly ? Error: Error: Query failed: bind message supplies 2 parameters, but prepared statement “” requires 1 Answer I think you’re supposed to use wildcards this way:

how to use wildcard for a column jsonb type

I have a table (named profile) in my Postgres database, which has 3 columns: ID, Day, Ftfm_profile of type jsonb, I tried to extract the row where the profile name (ftfm_profile->’name’) begins with ‘LFBB’ ( sql: LFBB%) using the wildcard as following: the expected result: I can’t seem to find the solution, thanks for your help Answer One option unnests

Get rows which contain exactly one special character

I have a SQL query which returns some rows having the below format: How can i filter to get rows which only have the format of ‘DB_host’ (place a condition to return values with only one occurrence of ‘_’) i tried using [0-9a-zA-Z_0-9a-zA-Z], but seems like its not right. Please suggest. Answer One option would be using REGEXP_COUNT and at