pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedPort Bug Report: parse error not detected on unterminated quote
5+ messages / 4 participants
[nested] [flat]
* Port Bug Report: parse error not detected on unterminated quote
@ 1999-06-29 17:46 Unprivileged user <nobody>
0 siblings, 2 replies; 5+ messages in thread
From: Unprivileged user @ 1999-06-29 17:46 UTC (permalink / raw)
To: pgsql-ports@postgresql.org
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Kyle Bateman
Your email address : kyle@actarg.com
Category : runtime: back-end: SQL
Severity : serious
Summary: parse error not detected on unterminated quote
System Configuration
--------------------
Operating System : Linux Redhat 5.2
PostgreSQL version : 6.5
Compiler used :
Hardware:
---------
Versions of other tools:
------------------------
Linux tao.actarg.com 2.0.36 #3 Tue Apr 6 14:20:35 MDT 1999 i686 unknown
--------------------------------------------------------------------------
Problem Description:
--------------------
If a single quote is left unmatched in the query, the parser
seems to throw away the rest of the line without detecting
an error.
If the quote appears before a where clause, the results can
be disasterous as the whole table might be deleted, updated,
etc.
--------------------------------------------------------------------------
Test Case:
----------
Enter a select like this:
select * from mytable where id = 1234;
You should get only one record.
Now put in an errant single quote:
select * from mytable' where id = 1234;
Now you get the whole table. This should really be a
syntax error of some kind.
If the query is a delete or an update, this can be a nasty
problem.
--------------------------------------------------------------------------
Solution:
---------
I suppose the parser should check at the end of the command
to see if any unterminated quoted material is still pending.
--------------------------------------------------------------------------
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [PORTS] Port Bug Report: parse error not detected on unterminated quote
@ 1999-06-30 13:31 Thomas Lockhart <lockhart@alumni.caltech.edu>
parent: Unprivileged user <nobody>
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Lockhart @ 1999-06-30 13:31 UTC (permalink / raw)
To: Kyle Bateman <kyle@actarg.com>; +Cc: pgsql-ports@postgreSQL.org
> Problem Description:
> --------------------
> If a single quote is left unmatched in the query, the parser
> seems to throw away the rest of the line without detecting
> an error.
> Test Case:
> ----------
> Enter a select like this:
> select * from mytable where id = 1234;
> You should get only one record.
>
> Now put in an errant single quote:
> select * from mytable' where id = 1234;
> Now you get the whole table. This should really be a
> syntax error of some kind.
And seems to be:
postgres=> select * from mytable' where id = 1234;
postgres'> '
postgres-> ;
ERROR: parser: parse error at or near "'"
postgres=>
This is on a RH5.2 system with with the cvs distribution of Postgres
(rather than v6.5 exactly). But the parsing behavior should be the
same. I'm not sure what could be different in our installations...
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [PORTS] Port Bug Report: parse error not detected on unterminated quote
@ 1999-06-30 14:19 Herouth Maoz <herouth@oumail.openu.ac.il>
parent: Unprivileged user <nobody>
1 sibling, 2 replies; 5+ messages in thread
From: Herouth Maoz @ 1999-06-30 14:19 UTC (permalink / raw)
To: Thomas Lockhart <lockhart@alumni.caltech.edu>; Kyle Bateman <kyle@actarg.com>; +Cc: pgsql-ports@postgreSQL.org
At 16:31 +0300 on 30/06/1999, Thomas Lockhart wrote:
> And seems to be:
>
> postgres=> select * from mytable' where id = 1234;
> postgres'> '
> postgres-> ;
> ERROR: parser: parse error at or near "'"
> postgres=>
>
> This is on a RH5.2 system with with the cvs distribution of Postgres
> (rather than v6.5 exactly). But the parsing behavior should be the
> same. I'm not sure what could be different in our installations...
In psql, it will probably never be a problem, because it demands that you
close the quotation mark (that "postgres'>" prompt). It doesn't send
anything to the backend until you have closed the quotation and type \g or
';'.
But what happens if the above query is sent through one of the other
interfaces, like pqlib?
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [PORTS] Port Bug Report: parse error not detected onunterminated quote
@ 1999-06-30 14:36 Kyle Bateman <kyle@actarg.com>
parent: Herouth Maoz <herouth@oumail.openu.ac.il>
1 sibling, 0 replies; 5+ messages in thread
From: Kyle Bateman @ 1999-06-30 14:36 UTC (permalink / raw)
To: pgsql-sql; +Cc: Herouth Maoz <herouth@oumail.openu.ac.il>
Herouth Maoz wrote:
> At 16:31 +0300 on 30/06/1999, Thomas Lockhart wrote:
>
> > And seems to be:
> >
> > postgres=> select * from mytable' where id = 1234;
> > postgres'> '
> > postgres-> ;
> > ERROR: parser: parse error at or near "'"
> > postgres=>
> >
> > This is on a RH5.2 system with with the cvs distribution of Postgres
> > (rather than v6.5 exactly). But the parsing behavior should be the
> > same. I'm not sure what could be different in our installations...
>
> In psql, it will probably never be a problem, because it demands that you
> close the quotation mark (that "postgres'>" prompt). It doesn't send
> anything to the backend until you have closed the quotation and type \g or
> ';'.
>
> But what happens if the above query is sent through one of the other
> interfaces, like pqlib?
>
I did a little more testing on it.
When running pqsl in interactive mode, everything works out OK. Pqsl insists
on getting the last terminating quote. However, if you enter:
psql mydb -c "select * from mytable' where id = 1234;"
you get the whole table, not just the one record. I first noticed the
problem using the TCL interface so I know it exists there as well as in
non-interactive psql.
--
----------------------------------------------------
Kyle Bateman President, Action Target Inc.
"Viva Yo!" kyle@actarg.com (801)377-8033x101
----------------------------------------------------
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [PORTS] Port Bug Report: parse error not detected onunterminated quote
@ 1999-06-30 15:16 Thomas Lockhart <lockhart@alumni.caltech.edu>
parent: Herouth Maoz <herouth@oumail.openu.ac.il>
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Lockhart @ 1999-06-30 15:16 UTC (permalink / raw)
To: Herouth Maoz <herouth@oumail.openu.ac.il>; +Cc: Kyle Bateman <kyle@actarg.com>; pgsql-ports@postgreSQL.org
> But what happens if the above query is sent through one of the other
> interfaces, like pqlib?
Right. It's a problem...
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~1999-06-30 15:16 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-06-29 17:46 Port Bug Report: parse error not detected on unterminated quote Unprivileged user <nobody>
1999-06-30 13:31 ` Thomas Lockhart <lockhart@alumni.caltech.edu>
1999-06-30 14:19 ` Re: [PORTS] Port Bug Report: parse error not detected on unterminated quote Herouth Maoz <herouth@oumail.openu.ac.il>
1999-06-30 14:36 ` Re: [PORTS] Port Bug Report: parse error not detected onunterminated quote Kyle Bateman <kyle@actarg.com>
1999-06-30 15:16 ` Re: [PORTS] Port Bug Report: parse error not detected onunterminated quote Thomas Lockhart <lockhart@alumni.caltech.edu>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox