I am sure that I have made a mistake somewhere. I read in different sites, that I can send SearchPath as a parameter in connection string for NpgsqlConnection. I tried that and it connects ok, but when I try to do select query on some table, it says "relation xx does not exist". I know I can use "set search_path='schema'"
query.
But I was wondering if I can do that by sending SearchPath with connection string or by changing some property parameter of NpgsqlConnection, because changing search_path for every query is not right for my case? Please suggest me something, because I am new to this... Any help is appreciated.
Asked
Active
Viewed 2,728 times
2

Mehbube Arman
- 472
- 1
- 7
- 18
-
Did you try setting your search path to 'public, schema' in your connection string? I hope it helps. – Francisco Junior Jul 06 '13 at 17:11
-
public search_path works.. But i want to set a different search path. Sorry I forgot to mention that before – Mehbube Arman Jul 07 '13 at 06:25
-
Hmm, I think I'm not understanding... If you use "search_path=public,schema" in your connection string, Npgsql will execute the set search_path='public,schema' command for you when it starts a new connection. You will have access to public and schema namespace. – Francisco Junior Jul 22 '13 at 23:13
-
2@MehbubeArman any luck finding solution to this problem? I have tried to set searchpath = MYDESIREDSCHEMA in connection string but getting error '42P01: relation "MyTableUsedInQuery" does not exist' – AHMAD SUMRAIZ Oct 10 '19 at 13:24
-
I had the same problem and setting grant fixed it for me : https://stackoverflow.com/a/7409967/4648930 – Muzib Dec 23 '22 at 08:38