简体   繁体   中英

Syntax error when inserting into foreign key

I keep getting errors trying to insert data into my table. I have tried:

insert into saferdb_dot_contacts (fax, email, "dot_num_id") 
values( 'nan', 'nan', 4);

ERROR: column "dot_num_id" of relation "saferdb_dot_contacts" >does not exist

I tried:

insert into saferdb_dot_contacts (fax, email, dot_num_id) 
values( 'nan', 'nan', 4);

ERROR: column "dot_num_id" of relation "saferdb_dot_contacts" >does not exist

I tried to access the field via

SELECT dot_num_id FROM saferdb_dot_contacts;

but got :

ERROR: column "dot_num_id" does not exist LINE 1: SELECT dot_num_id FROM >saferdb_dot_contacts;

I tried:

SELECT 'dot_num_id' FROM saferdb_dot_contacts;

Which gave me a strange output of a column labled ?column?

在此处输入图片说明

if it helps dot_num_id is has a foreign key relationship to another table.

EDIT: I also tried:

SELECT "dot_num_id" FROM saferdb_dot_contacts;

ERROR: column "dot_num_id" does not exist LINE 2: SELECT "dot_num_id" FROM saferdb_dot_contacts; ^ SQL state: 42703

在此处输入图片说明 Character: 58

You need to watch out for case sensivity and use double quotes. Try:

insert into saferdb_dot_contacts (fax, email, "DOT_Num_id") 
values( 'nan', 'nan', 4);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM