BUG #9068: invalid YY_START on Unicode identifier escape syntax

Started by Manuel Gómezabout 12 years ago5 messagesbugs
Jump to latest
#1Manuel Gómez
targen@gmail.com

The following bug has been logged on the website:

Bug reference: 9068
Logged by: Manuel Gómez
Email address: targen@gmail.com
PostgreSQL version: 9.3.2
Operating system: Linux
Description:

Long story short:

manuel@debian $ psql
psql (9.3.2)
Type "help" for help.

manuel=# U&""""
invalid YY_START
manuel@debian $

I was toying around with the Unicode identifier escape syntax and stumbled
upon this. It seems to work correctly if the identifier isn’t the last
token in the input:

$ psql
psql (9.3.2)
Type "help" for help.

manuel=# select 42 as U&"""";
"
----
42
(1 row)

manuel=# select 42 as U&""""+
manuel-#

(psql waits for the rest of the command)

A very minor annoyance, really, but still worth reporting since it kills the
client.

Observed identical behavior on 9.3.2 in 64-bit Debian 7.2 and 9.3beta1 on
32-bit Ubuntu natty.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Manuel Gómez (#1)
Re: BUG #9068: invalid YY_START on Unicode identifier escape syntax

targen@gmail.com writes:

Long story short:

manuel@debian $ psql
psql (9.3.2)
Type "help" for help.

manuel=# U&""""
invalid YY_START
manuel@debian $

Fixed, thanks for the report!

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#3Manuel Gómez
targen@gmail.com
In reply to: Tom Lane (#2)
Re: BUG #9068: invalid YY_START on Unicode identifier escape syntax

On Sun, Feb 2, 2014 at 7:30 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

targen@gmail.com writes:

Long story short:

manuel@debian $ psql
psql (9.3.2)
Type "help" for help.

manuel=# U&""""
invalid YY_START
manuel@debian $

Fixed, thanks for the report!

regards, tom lane

Thanks! Just tested this though, and I’m not sure it’s really working
as intended:

manuel@debian $ printf '%s\n' 'select 42 as U&"a"' | psql
ERROR: syntax error at end of input
LINE 1: select 42 as U&"a"
^
manuel@debian $ printf '%s\n' 'select 42 as "a"' | psql
a
----
42
(1 row)

manuel@lechuza $ psql
psql (9.4devel)
Type "help" for help.

manuel=# select 42 as U&"a"
manuel-#

(after that last command, it correctly waits for more input)

So apparently it works fine in interactive use of psql, but behavior
is inconsistent with other sorts of identifier tokens when the end of
input is an appropriate substitute for a terminator. This is perhaps
a minor annoyance since adding a semicolon solves it.

Aside from this, I have a few other bits of code failing, but they
seem to be happening in plpgsql — is this form of identifier escaping
supposed to work in that context? If so, I can try to produce a
minimal failing test case.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#4Manuel Gómez
targen@gmail.com
In reply to: Manuel Gómez (#3)
Re: BUG #9068: invalid YY_START on Unicode identifier escape syntax

On Mon, Feb 3, 2014 at 4:10 PM, Manuel Gómez <targen@gmail.com> wrote:

manuel@debian $ printf '%s\n' 'select 42 as U&"a"' | psql
ERROR: syntax error at end of input
LINE 1: select 42 as U&"a"
^

Sorry for the split mail; just noticed something else that is probably relevant.

Upon executing the failing command, the server log shows thus:

ERROR: syntax error at end of input at character 19
STATEMENT: select 42 as U&"a"

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Manuel Gómez (#3)
Re: BUG #9068: invalid YY_START on Unicode identifier escape syntax

=?UTF-8?Q?Manuel_G=C3=B3mez?= <targen@gmail.com> writes:

On Sun, Feb 2, 2014 at 7:30 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Thanks! Just tested this though, and I’m not sure it’s really working
as intended:

manuel@debian $ printf '%s\n' 'select 42 as U&"a"' | psql
ERROR: syntax error at end of input
LINE 1: select 42 as U&"a"
^

Hmmm ... looks like the EOF case wasn't correctly handled in the backend
lexer either. Sigh. Again, thanks for the report.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs