Syntax error when inserting into foreign key
up vote
0
down vote
favorite
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
sql postgresql
|
show 3 more comments
up vote
0
down vote
favorite
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
sql postgresql
1
Could it be that - as postgres claims -dot_num_id
doesn't exist onsaferdb_dot_contacts
? What is the schema ofsaferdb_dot_contacts
?
– Henning Koehler
Nov 11 at 1:42
1
BTW, in the last query you are trying to select the constant string 'dot_num_id' from the table, hence the output.
– Henning Koehler
Nov 11 at 1:44
1
Also, what happens when you try: insert into saferdb_dot_contacts (fax, email, 'dot_num_id') , with single quotes instead of double?
– Eray Balkanli
Nov 11 at 2:40
1
oooh I see, it is DOT_Num_id. Please try: Select "DOT_Num_id" from saferdb_dot_contacts and let me know.
– Eray Balkanli
Nov 11 at 3:03
1
No worries, glad to help :)
– Eray Balkanli
Nov 11 at 3:11
|
show 3 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
sql postgresql
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
sql postgresql
sql postgresql
edited Nov 11 at 2:58
asked Nov 11 at 1:32
Lev
1851214
1851214
1
Could it be that - as postgres claims -dot_num_id
doesn't exist onsaferdb_dot_contacts
? What is the schema ofsaferdb_dot_contacts
?
– Henning Koehler
Nov 11 at 1:42
1
BTW, in the last query you are trying to select the constant string 'dot_num_id' from the table, hence the output.
– Henning Koehler
Nov 11 at 1:44
1
Also, what happens when you try: insert into saferdb_dot_contacts (fax, email, 'dot_num_id') , with single quotes instead of double?
– Eray Balkanli
Nov 11 at 2:40
1
oooh I see, it is DOT_Num_id. Please try: Select "DOT_Num_id" from saferdb_dot_contacts and let me know.
– Eray Balkanli
Nov 11 at 3:03
1
No worries, glad to help :)
– Eray Balkanli
Nov 11 at 3:11
|
show 3 more comments
1
Could it be that - as postgres claims -dot_num_id
doesn't exist onsaferdb_dot_contacts
? What is the schema ofsaferdb_dot_contacts
?
– Henning Koehler
Nov 11 at 1:42
1
BTW, in the last query you are trying to select the constant string 'dot_num_id' from the table, hence the output.
– Henning Koehler
Nov 11 at 1:44
1
Also, what happens when you try: insert into saferdb_dot_contacts (fax, email, 'dot_num_id') , with single quotes instead of double?
– Eray Balkanli
Nov 11 at 2:40
1
oooh I see, it is DOT_Num_id. Please try: Select "DOT_Num_id" from saferdb_dot_contacts and let me know.
– Eray Balkanli
Nov 11 at 3:03
1
No worries, glad to help :)
– Eray Balkanli
Nov 11 at 3:11
1
1
Could it be that - as postgres claims -
dot_num_id
doesn't exist on saferdb_dot_contacts
? What is the schema of saferdb_dot_contacts
?– Henning Koehler
Nov 11 at 1:42
Could it be that - as postgres claims -
dot_num_id
doesn't exist on saferdb_dot_contacts
? What is the schema of saferdb_dot_contacts
?– Henning Koehler
Nov 11 at 1:42
1
1
BTW, in the last query you are trying to select the constant string 'dot_num_id' from the table, hence the output.
– Henning Koehler
Nov 11 at 1:44
BTW, in the last query you are trying to select the constant string 'dot_num_id' from the table, hence the output.
– Henning Koehler
Nov 11 at 1:44
1
1
Also, what happens when you try: insert into saferdb_dot_contacts (fax, email, 'dot_num_id') , with single quotes instead of double?
– Eray Balkanli
Nov 11 at 2:40
Also, what happens when you try: insert into saferdb_dot_contacts (fax, email, 'dot_num_id') , with single quotes instead of double?
– Eray Balkanli
Nov 11 at 2:40
1
1
oooh I see, it is DOT_Num_id. Please try: Select "DOT_Num_id" from saferdb_dot_contacts and let me know.
– Eray Balkanli
Nov 11 at 3:03
oooh I see, it is DOT_Num_id. Please try: Select "DOT_Num_id" from saferdb_dot_contacts and let me know.
– Eray Balkanli
Nov 11 at 3:03
1
1
No worries, glad to help :)
– Eray Balkanli
Nov 11 at 3:11
No worries, glad to help :)
– Eray Balkanli
Nov 11 at 3:11
|
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
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);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
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);
add a comment |
up vote
3
down vote
accepted
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);
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
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);
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);
answered Nov 11 at 3:10
Eray Balkanli
3,82041943
3,82041943
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245083%2fsyntax-error-when-inserting-into-foreign-key%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Could it be that - as postgres claims -
dot_num_id
doesn't exist onsaferdb_dot_contacts
? What is the schema ofsaferdb_dot_contacts
?– Henning Koehler
Nov 11 at 1:42
1
BTW, in the last query you are trying to select the constant string 'dot_num_id' from the table, hence the output.
– Henning Koehler
Nov 11 at 1:44
1
Also, what happens when you try: insert into saferdb_dot_contacts (fax, email, 'dot_num_id') , with single quotes instead of double?
– Eray Balkanli
Nov 11 at 2:40
1
oooh I see, it is DOT_Num_id. Please try: Select "DOT_Num_id" from saferdb_dot_contacts and let me know.
– Eray Balkanli
Nov 11 at 3:03
1
No worries, glad to help :)
– Eray Balkanli
Nov 11 at 3:11