Re: Re: [BUGS] BUG #4027: backslash escaping not disabled inplpgsql

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jonathan Guthrie" <jguthrie(at)brokersys(dot)com>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [BUGS] BUG #4027: backslash escaping not disabled inplpgsql
Date: 2009-04-09 16:26:52
Message-ID: 49DDDB7C.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
>> Can't that be managed with this CREATE FUNCTION option?:
>> SET configuration_parameter { TO value | = value | FROM CURRENT }
>
> It can be, the question is whether we're prepared to break
everything
> under the sun until people add that.

Well, surely the 8.3 behavior is not what we want.

(1) The plpgsql parser identifies the boundaries of the string based
on backslash escapes.

(2) The character string literal is interpreted based on the GUC
setting the first time the function is executed (and presumably the
first time executed after the function's invalidated).

(3) Subsequent changes to the GUC don't affect how it's interpreted.

scca=# show standard_conforming_strings ;
standard_conforming_strings
-----------------------------
on
(1 row)

scca=# create or replace function kjgtest() returns text language
plpgsql immutable strict as $$ begin return '\x49'; end; $$;
CREATE FUNCTION
scca=# select * from kjgtest();
kjgtest
---------
\x49
(1 row)

scca=# set standard_conforming_strings = off;
SET
scca=# select * from kjgtest();
kjgtest
---------
\x49
(1 row)

scca=# create or replace function kjgtest() returns text language
plpgsql immutable strict as $$ begin return '\x49'; end; $$;
CREATE FUNCTION
scca=# select * from kjgtest();
kjgtest
---------
I
(1 row)

scca=# set standard_conforming_strings = on;
SET
scca=# select * from kjgtest();
kjgtest
---------
I
(1 row)

scca=# create or replace function kjgtest() returns text language
plpgsql immutable strict as $$ begin return '\x49'; end; $$;
CREATE FUNCTION
scca=# set standard_conforming_strings = off;
SET
scca=# select * from kjgtest();
kjgtest
---------
I
(1 row)

-Kevin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2009-04-09 16:48:22 Re: possible bug not in open items
Previous Message Bruce Momjian 2009-04-09 16:18:32 Re: Re: [BUGS] BUG #4027: backslash escaping not disabled inplpgsql

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-04-09 16:26:56 Re: Closing some 8.4 open items
Previous Message Tom Lane 2009-04-09 16:25:25 Re: Strange query plan with redundant aggregate nodes