ERROR: relationship column does not exist PostgreSQL, could not run insert query
Hi i am trying to insert into tester3 tables, this fails when i use the syntax
insert into tester3 (UN0, UN1) values ( 1, 'jishnu1');
but
insert into tester3 values ( 1, 'jishnu1');
works fine.
mydb=# CREATE TABLE tester3
mydb-# (
mydb(# "UN0" integer,
mydb(# "UN1" VARCHAR(40)
mydb(# );
CREATE TABLE
mydb=# insert into tester3 (UN0, UN1) values ( 1, 'jishnu1');
ERROR: column "un0" of relation "tester3" does not exist
mydb=# \d tester3
Table "public.tester3"
Column | Type | Modifiers
--------+-----------------------+-----------
UN0 | integer |
UN1 | character varying(40) |
I think I am missing something very trivial, I have tried several column names, some work fine and some do not. I'm confused. Does PostgreSQL have a limitation on column names for which the first insert query syntax works?
Edit: User Gordon Linoff is correct using double quotes .
insert into tester3 ("UN0", "UN1") values ( 1, 'jishnu1');
works great
And as Frank Haykens pointed out other column names that worked without quotes where lower case .
Column lowercase is standard in PostgreSQL and also works without quotes
+3
source to share
3 answers