Re: [BUGS] Parser failed to return an error - Mailing list pgsql-bugs

From Tatsuo Ishii
Subject Re: [BUGS] Parser failed to return an error
Date
Msg-id 20170204.080929.854322444185739335.t-ishii@sraoss.co.jp
Whole thread Raw
In response to [BUGS] Parser failed to return an error  (rob stone <floriparob@gmail.com>)
Responses Re: [BUGS] Parser failed to return an error  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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
Fscan.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


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

pgsql-bugs by date:

Previous
From: Jeff Janes
Date:
Subject: Re: [BUGS] Parser failed to return an error
Next
From: "David G. Johnston"
Date:
Subject: Re: [BUGS] Parser failed to return an error