dxdb=> \d dxtest_loadprofiletosale
Table "public.dxtest_loadprofiletosale"
Column | Type | Modifiers
-------------+----------+-----------------------------------------------------------------------
id | integer | not null default nextval('dxtest_loadprofiletosale_id_seq'::regclass)
TransDate | date |
IssueDate | date |
CustomerNum | smallint | not null
Indexes:
"dxtest_loadprofiletosale_pkey" PRIMARY KEY, btree (id)
dxdb=> INSERT INTO dxtest_loadprofiletosale(id, TransDate, IssueDate, CustomerNum) VALUES(1, '2015-03-04','2015-01-01',01);
ERROR: column "transdate" of relation "dxtest_loadprofiletosale" does not exist
LINE 1: INSERT INTO dxtest_loadprofiletosale(id, TransDate, IssueDat...
excuse me,I already has the column "transdate", why it said does not exist?
It will be seen along with the error message “column does not exist”. This error indicates either that the requested column does not exist, or that the query is not correct. Here at Bobcares, we often handle requests from our customers to fix similar PostgreSQL errors as a part of our Server Management Services.
This error indicates either that the requested column does not exist, or that the query is not correct. Here at Bobcares, we often handle requests from our customers to fix similar PostgreSQL errors as a part of our Server Management Services.
PostgreSQL columns (object) names are case sensitive when specified with double quotes. Unquoted identifiers are automatically used as lowercase so the correct case sequence must be written with double quotes. When used with quotes, Postgresql is case sensitive regarding identifier names like table names and column names.
The column does not exist exception occurs when a column does not exist in the table. If the searching column does not exist in the table then it will raise the exception that the column does not exist in the table.
Your column is called "TransDate"
not transdate
. You created your table using double quotes for the column names, which makes them case sensitive and you must use double quotes all the time:
INSERT INTO dxtest_loadprofiletosale
(id, "TransDate", "IssueDate", "CustomerNum")
VALUES
(1, '2015-03-04','2015-01-01',01);
More details about SQL identifiers are in the manual:
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
In general it is better to never use double quotes - it will give you a lot less trouble in the long run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With