![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I have several databases. The objects are stored in the public schema of each database. I would like to move them to different schemas in one single database. In the softwares that use these databases, the sql statements don't mention the schemas. I found out that it should be possible to set the search_path variable in order to access the tables, views (etc...) without rewriting all the sql statements. I found this link : http://archives.postgresql.org/pgsql...1/msg00013.php I would be perfect for me, but unfortunately it doesn't work. If I append ";A6=set search_path to my_schema,public;" to my connection string, I get an error message telling me the relation doesn't exist (so I assume the search_path is not properly set). I tried many ways to do it (replaced A6 with ConnSettings, for instance) but none seems to work. Does anyone know how i can achieve this? |
#3
| |||
| |||
|
|
I found this link : http://archives.postgresql.org/pgsql...1/msg00013.php I would be perfect for me, but unfortunately it doesn't work. If I append ";A6=set search_path to my_schema,public;" to my connection string, I get an error message telling me the relation doesn't exist (so I assume the search_path is not properly set). I tried many ways to do it (replaced A6 with ConnSettings, for instance) but none seems to work. Does anyone know how i can achieve this? |
#4
| |||
| |||
|
|
Hello, I have several databases. The objects are stored in the public schema of each database. I would like to move them to different schemas in one single database. In the softwares that use these databases, the sql statements don't mention the schemas. I found out that it should be possible to set the search_path variable in order to access the tables, views (etc...) without rewriting all the sql statements. I found this link : http://archives.postgresql.org/pgsql...1/msg00013.php I would be perfect for me, but unfortunately it doesn't work. If I append ";A6=set search_path to my_schema,public;" to my connection string, I get an error message telling me the relation doesn't exist (so I assume the search_path is not properly set). I tried many ways to do it (replaced A6 with ConnSettings, for instance) but none seems to work. Does anyone know how i can achieve this? |
#5
| |||
| |||
|
|
Do you have different users? If yes, you can set the search_path per user, using "alter user foo set search_path= ..." once for all. |
|
Other solution, but untested (i don't know much about ODBC, but it works for connectionis with PHP for instance): set the search_path as a normal sql-statement, for instance: "set search_path=...; select * from foo" once per session. |

#6
| |||
| |||
|
|
You can set path in postgresql.conf. There is a parameter you can uncomment if you want to set it to something other than default: |
|
Your question should include your platform and version, too. That will will make the process of searching the solutions for your problem easier. |
#7
| |||
| |||
|
|
I did something similar some time ago (using 'A6'), and I found I needed to escape some of the characters in the SQL statement, as follows: space -> + underscore -> %5f comma -> %2c Then it worked for me. -M- |
#8
| |||
| |||
|
|
Mladen Gogala a écrit : You can set path in postgresql.conf. There is a parameter you can uncomment if you want to set it to something other than default: Hello, That might be a solution, but i thing this is a global setting ? |
#9
| |||
| |||
|
|
Mladen Gogala a écrit : You can set path in postgresql.conf. There is a parameter you can uncomment if you want to set it to something other than default: That might be a solution, but i thing this is a global setting ? |
#10
| |||
| |||
|
|
Tanguy <tanguy (AT) nowhere (DOT) fr> wrote: Mladen Gogala a écrit : You can set path in postgresql.conf. There is a parameter you can uncomment if you want to set it to something other than default: Hello, That might be a solution, but i thing this is a global setting ? Exactly. Andreas |

![]() |
| Thread Tools | |
| Display Modes | |
| |