Reputation: 1
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)
Upvotes: 0
Views: 103
Reputation: 127086
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);
Upvotes: 1