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?



enter image description here



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




enter image description hereCharacter: 58










share|improve this question




















  • 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






  • 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















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?



enter image description here



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




enter image description hereCharacter: 58










share|improve this question




















  • 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






  • 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













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?



enter image description here



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




enter image description hereCharacter: 58










share|improve this question















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?



enter image description here



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




enter image description hereCharacter: 58







sql postgresql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 on saferdb_dot_contacts? What is the schema of saferdb_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




    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




    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












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);





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    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

























    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);





    share|improve this answer

























      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);





      share|improve this answer























        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);





        share|improve this answer












        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);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 3:10









        Eray Balkanli

        3,82041943




        3,82041943






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Full-time equivalent

            Bicuculline

            さくらももこ