I all,
Could you just have a look to the output below? I try to add a column to a
table named "in" (I know "in" is a reserved keyword but the table exists and
I cannot change it). Postgresql complains that the column already exist but
it didn't. Am I doing something wrong ?
Thanks to point me my error or to give me any advice to add the column I
need.
Regards
David
Welcome to psql 8.3.0, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
Warning: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
postgres=# \c reference
You are now connected to database "reference".
reference=# \d "in"
Table "public.in"
Column | Type | Modifiers
------------+-----------------------------+------------------------
innum | character varying(10) | not null
indesc_pri | character varying(100) |
indesc_sec | character varying(100) |
ts | timestamp without time zone | not null default now()
Indexes:
"in_pk" PRIMARY KEY, btree (innum)
reference=# alter table 'IN' add column INDESCS VARCHAR[];
ERROR: syntax error at or near "'IN'"
LINE 1: alter table 'IN' add column INDESCS VARCHAR[];
^
reference=# alter table "IN" add column INDESCS VARCHAR[];
ERROR: column "indescs" of relation "IN" already exists
reference=# \d "in"
Table "public.in"
Column | Type | Modifiers
------------+-----------------------------+------------------------
innum | character varying(10) | not null
indesc_pri | character varying(100) |
indesc_sec | character varying(100) |
ts | timestamp without time zone | not null default now()
Indexes:
"in_pk" PRIMARY KEY, btree (innum)
reference=# alter table "IN" add column DESCS VARCHAR[];
ALTER TABLE
reference=# \d "in"
Table "public.in"
Column | Type | Modifiers
------------+-----------------------------+------------------------
innum | character varying(10) | not null
indesc_pri | character varying(100) |
indesc_sec | character varying(100) |
ts | timestamp without time zone | not null default now()
Indexes:
"in_pk" PRIMARY KEY, btree (innum)
reference=#