Re: Re: [BUGS] BUG #4027: backslash escaping not disabled inplpgsql - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: Re: [BUGS] BUG #4027: backslash escaping not disabled inplpgsql
Date
Msg-id 49DDDB7C.EE98.0025.0@wicourts.gov
Whole thread Raw
In response to Re: Re: [BUGS] BUG #4027: backslash escaping not disabled inplpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: [BUGS] BUG #4027: backslash escaping notdisabled inplpgsql
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote: 
> "Kevin Grittner" <Kevin.Grittner@wicourts.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Strange query plan with redundant aggregate nodes
Next
From: Bruce Momjian
Date:
Subject: Re: Resetting cluster-wide statistics