0

I am tying to perform insert with dblink in postgres but it is throwing error column "Test" does not exist

Select * 
from dblink('host=localhost user=postgres password=Test dbname=wb',
            'Insert Into tblProducts(AccountNumber,AccountProductNumber,supplierproductnumber)
             Values( 2012, 2022,'Test') Returning ProductNumber'
     ) AS tblProducts(ProductNumber integer)

1 Answer 1

1

You have to escape the quotes within the payload, using an additional quote '' (two single quotes):

Select * 
from dblink('host=localhost user=postgres password=Test dbname=wb',
            'Insert Into tblProducts(AccountNumber,AccountProductNumber,supplierproductnumber)
             Values( 2012, 2022,''Test'') Returning ProductNumber'
     ) AS tblProducts(ProductNumber integer);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.