Received: from www.actarg.com (root@[209.180.91.25]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA29150 for ; Wed, 30 Jun 1999 10:31:50 -0400 (EDT) (envelope-from kyle@actarg.com) Received: from actarg.com (root@tao.actarg.com [192.168.1.1]) by www.actarg.com (8.8.7/8.8.7) with ESMTP id IAA18545; Wed, 30 Jun 1999 08:34:32 -0600 Received: from actarg.com (kyle@chi.actarg.com [192.168.2.16]) by actarg.com (8.8.7/8.8.7) with ESMTP id IAA26085; Wed, 30 Jun 1999 08:31:38 -0600 Sender: kyle@actarg.com Message-ID: <377A2B87.AF707E46@actarg.com> Date: Wed, 30 Jun 1999 08:36:55 -0600 From: Kyle Bateman Organization: Action Target Inc X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org CC: Herouth Maoz Subject: Re: [PORTS] Port Bug Report: parse error not detected onunterminated quote References: <199906291746.NAA20468@hub.org> Content-Type: multipart/alternative; boundary="------------F4CAA17E86C1305C0A0E16D7" --------------F4CAA17E86C1305C0A0E16D7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 ---------------------------------------------------- --------------F4CAA17E86C1305C0A0E16D7 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit 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
 ----------------------------------------------------
  --------------F4CAA17E86C1305C0A0E16D7--