npgsql search_path not working
npgsql search_path not working
I've a script like the following:
SET search_path = MySchema;
INSERT INTO MyTable() values ()
MyTable is actually created in MySchema, so if I change the script to
INSERT INTO MySchema.MyTable() values ()
It works
Now I'm generating some SQL files to recreate a database structure, so we have the scripts generated with "SET search_path = MySchema;"
Is there a way to make this work?
Using NPGSQL version 3.0.4.0
Thank you, it helped to sort the issue, but my actual problem was related to having DDL and DML on the same script.
– MetalGeorge
19 hours ago
1 Answer
1
My mistake, it's not related to the schema itself, the issue is when having both DDL and DML instructions together.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Apparently the search path can be defined in the connection string: "Search Path Sets the schema search path." See "Connection String Parameters" - "Misc". Maybe this is an option for you?
– sticky bit
Jun 30 at 2:37