Re: SQL INSERT bug with 6.5.3 and 7.0.2

Поиск
Список
Период
Сортировка
От John Gotts
Тема Re: SQL INSERT bug with 6.5.3 and 7.0.2
Дата
Msg-id 200006252357.TAA75711@ww2.tqstats.com
обсуждение исходный текст
Ответ на SQL INSERT bug with 6.5.3 and 7.0.2  (John Gotts <jgotts@ww2.tqstats.com>)
Список pgsql-general
In message <Pine.LNX.4.20.0006251829460.6484-100000@tacdyn.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_codecharacter(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@linuxsavvy.com>  http://www.linuxsavvy.com/staff/jgotts

В списке pgsql-general по дате отправления:

Предыдущее
От: John Gotts
Дата:
Сообщение: SQL INSERT bug with 6.5.3 and 7.0.2
Следующее
От: "Oliver Elphick"
Дата:
Сообщение: Re: SQL INSERT bug with 6.5.3 and 7.0.2