\d dxtest_loadprofiletosale Table "public.dxtest_loadprofiletosale" Column | Type ...">

PostgreSQL sql server command line column "does not exist"

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... 

Sorry, I already have a transdate column, why did he say it doesn't exist?

+5
source share
1 answer

Your column is called "TransDate" not transdate . You created the table using double quotes for column names, which makes them case sensitive, and you must use double quotes all :

 INSERT INTO dxtest_loadprofiletosale (id, "TransDate", "IssueDate", "CustomerNum") VALUES (1, '2015-03-04','2015-01-01',01); 

For more information on SQL identifiers, see the manual:
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

In general, it's better to never use double quotation marks - this will give you much less trouble in the long run.

+8
source

Source: https://habr.com/ru/post/1214641/


All Articles