<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Re: [pgpool-general: 2089] Re: standard_conforming_strings broken by PgPool?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Ah, interesting. It looks like changing the parameter requires a DB<BR>
restart (simply reloading the config appears not to work despite the log<BR>
file indicating the parameter change)...<BR>
<BR>
I'll report back after I get permission to restart the back-ends<BR>
(unfortunately, the servers are in production)...<BR>
<BR>
----------<BR>
&nbsp;2572 2013-09-02 10:25:27.944 BST LOG:&nbsp; received SIGHUP, reloading<BR>
configuration files<BR>
&nbsp;2572 2013-09-02 10:25:27.945 BST LOG:&nbsp; parameter<BR>
&quot;standard_conforming_strings&quot; changed to &quot;off&quot;<BR>
----------<BR>
<BR>
Thanks for the pointer.<BR>
<BR>
Regards,<BR>
<BR>
Andy Bruce<BR>
<BR>
-----Original Message-----<BR>
From: Tatsuo Ishii &lt;ishii@postgresql.org&gt;<BR>
To: andrew.bruce@hslmobile.com<BR>
Cc: pgpool-general@pgpool.net<BR>
Subject: Re: [pgpool-general: 2089] Re: standard_conforming_strings<BR>
broken by PgPool?<BR>
Date: Sat, 31 Aug 2013 06:51:19 +0900 (JST)<BR>
<BR>
&gt; Hi Ishii san,<BR>
&gt;<BR>
&gt; You mentioned &quot;turn off standard_confirm_string in postgresql.conf&quot;. I<BR>
&gt; take it you mean the parameter &quot;standard_conforming_strings&quot;?<BR>
<BR>
Yes.<BR>
<BR>
&gt; If so, I already have that set to off in the postgresql config on each<BR>
&gt; server in the cluster. this works when connecting directly to a database<BR>
&gt; in the cluster, but not through PgPool-II.<BR>
<BR>
Strange. Workes for me...<BR>
<BR>
[t-ishii@localhost test]$ psql -p 11001 test<BR>
Pager usage is off.<BR>
psql (9.2.4)<BR>
Type &quot;help&quot; for help.<BR>
<BR>
test=# show pool_version;<BR>
&nbsp;&nbsp;&nbsp; pool_version&nbsp;&nbsp;&nbsp;&nbsp;<BR>
---------------------<BR>
&nbsp;3.3.0 (tokakiboshi)<BR>
(1 row)<BR>
<BR>
test=# show standard_conforming_strings;<BR>
&nbsp;standard_conforming_strings<BR>
-----------------------------<BR>
&nbsp;off<BR>
(1 row)<BR>
<BR>
test=# SELECT '\'';<BR>
WARNING:&nbsp; nonstandard use of \' in a string literal<BR>
LINE 1: SELECT '\'';<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^<BR>
HINT:&nbsp; Use '' to write quotes in strings, or use the escape string syntax (E'...').<BR>
&nbsp;?column?<BR>
----------<BR>
&nbsp;'<BR>
(1 row)<BR>
<BR>
test=#<BR>
--<BR>
Tatsuo Ishii<BR>
SRA OSS, Inc. Japan<BR>
English: <A HREF="http://www.sraoss.co.jp/index_en.php">http://www.sraoss.co.jp/index_en.php</A><BR>
Japanese: <A HREF="http://www.sraoss.co.jp">http://www.sraoss.co.jp</A><BR>
<BR>
&gt; Regards,<BR>
&gt;<BR>
&gt; Andy Bruce<BR>
&gt;<BR>
&gt; -----Original Message-----<BR>
&gt; From: Tatsuo Ishii &lt;ishii@postgresql.org&gt;<BR>
&gt; To: andrew.bruce@hslmobile.com<BR>
&gt; Cc: pgpool-general@pgpool.net<BR>
&gt; Subject: Re: [pgpool-general: 2089] Re: standard_conforming_strings<BR>
&gt; broken by PgPool?<BR>
&gt; Date: Fri, 30 Aug 2013 16:31:31 +0900 (JST)<BR>
&gt;<BR>
&gt; This is a known problem.<BR>
&gt;<BR>
&gt; pgpool-II currently fails to forward &quot;parameter status&quot; packet to<BR>
&gt; clients, including psql (actually libpq, the clibrary for PostgreSQL<BR>
&gt; protocol linked to psql).<BR>
&gt;<BR>
&gt; Libpq does a special hack inside to deal with<BR>
&gt; standard_confirming_strings. If backend reply back a parameter status<BR>
&gt; packet describing &quot;standard_confirming_strings is now off&quot; (this could<BR>
&gt; happen when you send command &quot;set standard_confirming_strings to<BR>
&gt; off&quot;), it remembers it and behaves differently later on. Unfortunately<BR>
&gt; pgpool-II does not forward the packet to psql. So libpq doesn't know<BR>
&gt; that.<BR>
&gt;<BR>
&gt; A workaround for this is, turn off standard_confirm_string in<BR>
&gt; postgresql.conf.<BR>
&gt;<BR>
&gt; Another workaround is, using PGOPTIONS environment variable.<BR>
&gt;<BR>
&gt; PGOPTIONS=&quot;-c standard_conforming_strings=off&quot; psql...<BR>
&gt;<BR>
&gt; The reason why those workarounds work is, pgpool-II can forward the<BR>
&gt; packet in the connection phase.<BR>
&gt; --<BR>
&gt; Tatsuo Ishii<BR>
&gt; SRA OSS, Inc. Japan<BR>
&gt; English: <A HREF="http://www.sraoss.co.jp/index_en.php">http://www.sraoss.co.jp/index_en.php</A><BR>
&gt; Japanese: <A HREF="http://www.sraoss.co.jp">http://www.sraoss.co.jp</A><BR>
&gt;<BR>
&gt;&gt; Hi Folks,<BR>
&gt;&gt;<BR>
&gt;&gt; Can anyone else confirm or deny the issue I outlined below?<BR>
&gt;&gt;<BR>
&gt;&gt; I should add that this is on PgPool-II Version 3.3 with PostgreSQL 9.2.4 backends...<BR>
&gt;&gt;<BR>
&gt;&gt; I'd really like a solution (or work-around) - other than rewriting the client applications! ;-)<BR>
&gt;&gt;<BR>
&gt;&gt; Regards,<BR>
&gt;&gt;<BR>
&gt;&gt; Andy Bruce<BR>
&gt;&gt;<BR>
&gt;&gt; Date: Wed, 21 Aug 2013 16:27:49 +0100<BR>
&gt;&gt; From: &quot;Andrew Bruce&quot; &lt;andrew.bruce@hslmobile.com&gt;<BR>
&gt;&gt; To: &lt;pgpool-general@pgpool.net&gt;<BR>
&gt;&gt; Subject: [pgpool-general: 2061] standard_conforming_strings broken by<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PgPool?<BR>
&gt;&gt;<BR>
&gt;&gt; Hi folks,<BR>
&gt;&gt;<BR>
&gt;&gt; I'm looking at an interesting problem:<BR>
&gt;&gt;<BR>
&gt;&gt; I have client software that needs to use the backslash character as an<BR>
&gt;&gt; escape character. For a regular PostgreSQL database, this is not a<BR>
&gt;&gt; problem as the parameter 'standard_conforming_strings' can be turned<BR>
&gt;&gt; 'off' and queries such as:<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT '\'';<BR>
&gt;&gt;<BR>
&gt;&gt; will correctly return:<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ?column?<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (1 row)<BR>
&gt;&gt;<BR>
&gt;&gt; However, if I try to do this on the cluster, through PgPool, despite<BR>
&gt;&gt; turning off standard_conforming_strings, the backslash is still treated<BR>
&gt;&gt; as a literal string character, so the result of the above query becomes:<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; postgres=# select '\'';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; postgres'#<BR>
&gt;&gt;<BR>
&gt;&gt; indicating that the CLI suspects that I have failed to close the single<BR>
&gt;&gt; quotes...<BR>
&gt;&gt;<BR>
&gt;&gt; To reproduce:<BR>
&gt;&gt;<BR>
&gt;&gt; Connect to the DB cluster using the PgPool IP address:<BR>
&gt;&gt; --- Begin Output from PgPool Connection ---<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb=# select '\'';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb'# ^C<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb=# set standard_conforming_strings = 'off';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb=# select '\'';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb'# ^C<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb=# \q<BR>
&gt;&gt; --- End Output from PgPool Connection ---<BR>
&gt;&gt;<BR>
&gt;&gt;<BR>
&gt;&gt; Connect directly to one of the PostgreSQL database servers in the<BR>
&gt;&gt; cluster, bypassing PgPool:<BR>
&gt;&gt; --- Begin Output from Dedicated DB Connection ---<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb=# select '\'';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb'# ^C<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb=# set standard_conforming_strings = 'off';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; postgres=# select '\'';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WARNING:&nbsp; nonstandard use of \' in a string literal<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LINE 1: select '\'';<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HINT:&nbsp; Use '' to write quotes in strings, or use the escape<BR>
&gt;&gt; string syntax (E'...').<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ?column?<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (1 row)<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sampledb=# \q<BR>
&gt;&gt; --- End Output from Dedicated DB Connection ---<BR>
&gt;&gt;<BR>
&gt;&gt; Is this a known issue, or is there something I'm missing here?<BR>
&gt;&gt;<BR>
&gt;&gt; Thanks in advance of any helpful advice!<BR>
&gt;&gt;<BR>
&gt;&gt; Regards,<BR>
&gt;&gt;<BR>
&gt;&gt; Andy Bruce<BR>
&gt;<BR>
&gt; ______________________________________________________________________<BR>
&gt; This email has been scanned by the Symantec Email Security.cloud service.<BR>
&gt; For more information please visit <A HREF="http://www.symanteccloud.com">http://www.symanteccloud.com</A><BR>
&gt; ______________________________________________________________________<BR>
<BR>
______________________________________________________________________<BR>
This email has been scanned by the Symantec Email Security.cloud service.<BR>
For more information please visit <A HREF="http://www.symanteccloud.com">http://www.symanteccloud.com</A><BR>
______________________________________________________________________<BR>
</FONT>
</P>

</BODY>
</HTML>