so I am trying to run a script like this one:
select id from owner where owner.name = "john's"
and I am getting this error: ERROR: column "john's" does not exist
.
Also I tried like this: where owner.name = 'john\'s'
, but it dit not work
Anyone knows how I can run a query like this one?
Postgres replace singlequote with two single quotes In Postgresql, REPLACE function can be used to replace the single quote with two single quotes in the string. Syntax: REPLACE(source, old_data, new_data ); Where the source is string or data where we want to replace.
Normally single and double quotes are commonly used with any text data in PostgreSQL. To ignore or escape the single quote is a common requirement of all database developers. By using double quotes and backslash we can avoid the complexity of single quotes as well as it is easy to read and maintain.
You need to escape single quote when the literal is enclosed in single code using the backslash(\) or need to escape double quotes when the literal is enclosed in a double code using a backslash(\).
Quotes and double quotes should be escaped using \.
You can escape single quotes when you double them. For example:
= 'john''s'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With