Re: scan.l: check_escape_warning()

Lists: pgsql-hackers
From: Michael Meskes <meskes(at)postgresql(dot)org>
To: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: scan.l: check_escape_warning()
Date: 2008-01-11 15:16:12
Message-ID: 20080111151612.GA18802@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

could anyone please enlighten me whether this function is still needed?
AFAICT check_escape_warning() only has significant action if
warn_on_first_escape is true. This variable is set to true only on label
xqstart, but to false on xestart. However, check_escape_warning() and
check_string_escape_warning() btw. are only called in mode xe. Seems to
me that both are never called, or what am I missing?

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: scan.l: check_escape_warning()
Date: 2008-01-11 15:41:17
Message-ID: 13483.1200066077@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes <meskes(at)postgresql(dot)org> writes:
> could anyone please enlighten me whether this function is still needed?
> AFAICT check_escape_warning() only has significant action if
> warn_on_first_escape is true. This variable is set to true only on label
> xqstart, but to false on xestart. However, check_escape_warning() and
> check_string_escape_warning() btw. are only called in mode xe. Seems to
> me that both are never called, or what am I missing?

Huh?

regression=# \set VERBOSITY verbose
regression=# select '\002'::text;
WARNING: 22P06: nonstandard use of escape in a string literal
LINE 1: select '\002'::text;
^
HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
LOCATION: check_escape_warning, scan.l:967
text
------
\x02
(1 row)

regression=# select '\\'::text;
WARNING: 22P06: nonstandard use of \\ in a string literal
LINE 1: select '\\'::text;
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
LOCATION: check_string_escape_warning, scan.l:952
text
------
\
(1 row)

Perhaps there's some discrepancy between the ecpg and backend lexers
as to where these are called?

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: scan.l: check_escape_warning()
Date: 2008-01-11 17:27:01
Message-ID: 4787A6E5.9000801@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes wrote:
> Hi,
>
> could anyone please enlighten me whether this function is still needed?
> AFAICT check_escape_warning() only has significant action if
> warn_on_first_escape is true. This variable is set to true only on label
> xqstart, but to false on xestart. However, check_escape_warning() and
> check_string_escape_warning() btw. are only called in mode xe. Seems to
> me that both are never called, or what am I missing?
>

What you are missing is that xqstart can lead to mode xe if
standard_conforming_strings is false:

{xqstart} {
warn_on_first_escape = true;
saw_high_bit = false;
SET_YYLLOC();
if (standard_conforming_strings)
BEGIN(xq);
else
BEGIN(xe);
startlit();
}

cheers

andrew


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: scan.l: check_escape_warning()
Date: 2008-01-13 11:43:12
Message-ID: 20080113114312.GA21082@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jan 11, 2008 at 10:41:17AM -0500, Tom Lane wrote:
> Perhaps there's some discrepancy between the ecpg and backend lexers
> as to where these are called?

You're right. There is no way to (un)select standard conforming strings
which makes up for the difference. Thanks for pointing me into the right
direction.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: scan.l: check_escape_warning()
Date: 2008-01-14 19:31:04
Message-ID: 23823.1200339064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Michael Meskes <meskes(at)postgresql(dot)org> writes:
> On Fri, Jan 11, 2008 at 10:41:17AM -0500, Tom Lane wrote:
>> Perhaps there's some discrepancy between the ecpg and backend lexers
>> as to where these are called?

> You're right. There is no way to (un)select standard conforming strings
> which makes up for the difference.

If that's how it is going to be, would you remove or #ifdef NOT_USED
the escape_string_warning function? The 'function defined but not used'
warning that it's producing now is kind of annoying ...

regards, tom lane