Re: SQL INSERT bug with 6.5.3 and 7.0.2

From: John Gotts <jgotts(at)ww2(dot)tqstats(dot)com>
To: "Robert J(dot) Sprawls" <sprawlsr(at)worldnet(dot)att(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL INSERT bug with 6.5.3 and 7.0.2
Date: 2000-06-25 23:57:55
Message-ID: 200006252357.TAA75711@ww2.tqstats.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In message <Pine(dot)LNX(dot)4(dot)20(dot)0006251829460(dot)6484-100000(at)tacdyn(dot)com>, "Robert J. Spr
awls" writes:

>On Sun, 25 Jun 2000, John Gotts wrote:

>JG>We're experiencing a problem with the parser with both 6.5.3 and 7.0.2.

>JG>The following is with 7.0.2. 6.5.3 is similar.

>JG>umpire(rc3.d)% psql -u fmfts
>JG>psql: Warning: The -u option is deprecated. Use -U.
>JG>...
>JG>fmfts=# CREATE TABLE "contact_people" (
>JG>fmfts(# "user_id" character(30),
>JG>fmfts(# "account_id" character(30),
>JG>fmfts(# "exchange_id" character(30),
>JG>fmfts(# "isin_code" character(30),
>JG>fmfts(# "symbol" character(30),
>JG>fmfts(# "name" character(30),
>JG>fmfts(# "position" character(30),
>JG>fmfts(# "email_address" character(30));

>Why are you enclosing the field names in quotes? That isn't neccessary.

This is just a cut from pg_dump and a paste into psql of the exact SQL
statement. I doubt pg_dump would get this wrong.

My understanding is that quote characters allow you to have fields with capital
letters and spaces, but using them unnecessarily is harmless.

>JG>fmfts=# insert into contact_people (user_id,name,position,email_address) va
>lues ('jgotts','hello',null,null);
>JG>ERROR: parser: parse error at or near "position"
>JG>fmfts=# insert into contact_people (user_id,name,"position",email_address)
>values ('jgotts','hello',null,null);
>JG>INSERT 20402 1

>JG>The problem also appears with libpq.

>JG>Any idea why this would occur?

>It could be fallout from enclosing the field names in quotes, but why it
>doesn't fail on all of them I don't know. Try without the quotes in the
>table definition.

fmfts=# CREATE TABLE contact_people (user_id character(30), account_id character(30), exchange_id character(30), isin_code character(30), symbol character(30), name character(30), position character(30), email_address character(30));
ERROR: parser: parse error at or near "position"

The plot thickens...

This is looking more and more like a bug in PostgreSQL's SQL parser.

John

--
John GOTTS <jgotts(at)linuxsavvy(dot)com> http://www.linuxsavvy.com/staff/jgotts

Browse pgsql-general by date

  From Date Subject
Next Message John Gotts 2000-06-26 01:32:34 Re: SQL INSERT bug with 6.5.3 and 7.0.2
Previous Message Oliver Elphick 2000-06-25 23:55:20 Re: SQL INSERT bug with 6.5.3 and 7.0.2