From: | Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> |
---|---|
To: | floriparob(at)gmail(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Parser failed to return an error |
Date: | 2017-02-03 23:09:29 |
Message-ID: | 20170204.080929.854322444185739335.t-ishii@sraoss.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> Linux roblaptop 4.9.0-1-amd64 #1 SMP Debian 4.9.2-2 (2017-01-12) x86_64
> GNU/Linux
>
>
> I was running a query like:-
>
> SELECT TO_CHAR(my_date,'dd-mm-yyyy) FROM my_table;
>
> and I forgot to type the second single quotation mark at the end of the
> mask string.
>
> Under psql it just hung and I had to Ctrl-C to go back to a prompt and
> under JDBC it hung as well and EQ just said "error", as in a failure of
> some sort.
>
> I would have expected either a 42601 error or maybe a 03000 error to
> have been returned.
>
>
> If you need any further information, please let me know.
Sounds like psql application or JDBC specific behaviors (not sure
expected ones though). I was able to confirm that the PostgreSQL
backend correctly returns a 42601 error in this case by using
"pgproto" (https://github.com/tatsuo-ishii/pgproto) which handles
PostgreSQL frontend/backend protocol in low level.
$ pgproto -f /tmp/p -d test
FE=> Query(query="CREATE TABLE my_table(my_date date);")
<= BE CommandComplete(CREATE TABLE)
<= BE ReadyForQuery(I)
FE=> Query(query="SELECT TO_CHAR(my_date,'dd-mm-yyyy) FROM my_table;")
<= BE ErrorResponse(S ERROR V ERROR C 42601 M unterminated quoted string at or near "'dd-mm-yyyy) FROM my_table;" P 24 F scan.l L 1086 R scanner_yyerror )
<= BE ReadyForQuery(I)
FE=> Terminate
The test data used:
-------------------------------------------------
# Create table
'Q' "CREATE TABLE my_table(my_date date);"
# Read reply from backend
'Y'
# Issue the query in question
'Q' "SELECT TO_CHAR(my_date,'dd-mm-yyyy) FROM my_table;"
# Read reply from backend
'Y'
# Terminate session
'X'
-------------------------------------------------
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-02-03 23:16:48 | Re: Parser failed to return an error |
Previous Message | Jeff Janes | 2017-02-03 21:10:12 | Re: Parser failed to return an error |