On Thu, 18 Jun 2015 07:29:37 +0000
"Yogesh. Sharma" <Yogesh1.Sharma@nectechnologies.in> wrote:
> HI Everyone,
>
> Below DB query is showing below error on postgresql9.3.
> SELECT '\'' || t2.name || '\'', '\'' || t1.phone_number || '\'', '\'' || t1.details || '\'', '\'' || t1.description
||'\'', '\'' || (CASE WHEN t1.s_id IS NULL THEN 'N/A' ELSE t3.s_type END) || '\'', '\'' || t1.s_id || '\'' FROM
abc_tbleAS t1 LEFT JOIN pqrtable AS t2 ON t1.s_id = nid LEFT JOIN te AS t3 ON t1.s_id = t3.s_id;
> Invalid command \''. Try \? for help.
> But Above query is working fine in postgresql8.3.
> Solution is provided by someone:-
> The SQL standard defines two single quotes to escape one inside a literal: ''''
> Postgres 8.3 defaulted to a non-standard behavior where it was allowed to escape a single quote using a backslash:
'\''
> This deviation from the SQL standard was always discouraged and can be controlled through the configuration parameter
standard_conforming_strings<http://www.postgresql.org/docs/current/static/runtime-config-compatible.html#GUC-STANDARD-CONFORMING-STRINGS>
> With version 9.1 the default for this parameter was changed from off to on. Version 8.1 and later would emit a
warningwhen you used the non-standard way of escaping single quotes (unless you explicitly turned that off)
>
>
> Could you please provide below information.
> How to change standard_conforming_strings value of postgresql.conf? I have checked but this option is not found in
postgresql.conf.
Add it to the file.
Also, don't reply to unrelated threads with new questions, a lot of
people won't see your question if you do that, and if nobody sees
your question you won't get an answer.
--
Bill Moran