Re: big problem

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Frank_Lupo Frank_Lupo <frank_lupo(at)telemail(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: big problem
Date: 2002-03-11 17:31:45
Message-ID: 3C8CEA01.2DCFB420@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Frank_Lupo Frank_Lupo wrote:
>
> Problem in insert
>
> CREATE TABLE "irelbcmb" (
> "id" int4,
> "id_pad" int4,
> "desc" int4,
> "cod" varchar(40),
> "sys_var" varchar(1),
> "nom_var" varchar(16)
> ) WITH OIDS;
>
> gedis30=# insert into irelbcmb (id,id_pad,desc,cod,sys_var,nom_var) values 1,1,1,"pippo","1","pippo");
> ERROR: parser: parse error at or near "desc"

PostgreSQL allowed for the CREATE TABLE with a column of "desc" because
you used double-quotes around the name. DESC is a keyword as in:

SELECT name
FROM employees
ORDER BY name DESC;
^^^^

Therefore, if you use it as a column, you must put double-quotes around
it in all your queries:

INSERT INTO irelbcmb (id, id_pad, "desc", cod, sys_var, nom_var)
VALUES (1, 1, 1, 'pippo','1','pippo');

Hope that helps,

Mike Mascari
mascarm(at)mascari(dot)com

In response to

  • big problem at 2002-03-11 08:22:44 from Frank_Lupo Frank_Lupo

Browse pgsql-general by date

  From Date Subject
Next Message Jeffrey W. Baker 2002-03-11 17:34:28 pg_toast table growth out of control
Previous Message Stephan Szabo 2002-03-11 17:19:59 Re: ERROR: DefineIndex: index function must be marked