An ON UPDATE
trigger was changing the parameters.
Use the SET
clause on the CREATE FUNCTION
statement if you need to override search_path
within a function.
Frage
When inserting or updating a table in PostgreSQL v9.2 via psql with autocommit enabled, after the first operation, the search_path changes. It happens whether I issue an explicit commit or not.
Thank you very much for your help.
$ psql -d db_name -U my_user
AUTOCOMMIT is: off
psql.bin (9.2.4)
Type "help" for help
No entry for terminal type "xterm";
using dumb terminal settings.
db_name=> show search_path;
search_path
-------------
my_user
(1 row)
db_name=> select session_user, current_user;
session_user | current_user
--------------+--------------
my_user | my_user
(1 row)
db_name=> update state_list set comments='new comments.' where id_state_list = 1;
UPDATE 1
db_name=> commit;
COMMIT
db_name=> show search_path;
search_path
-------------
auditor, public
(1 row)
db_name=> select session_user, current_user;
session_user | current_user
--------------+--------------
my_user | my_user
(1 row)
db_name=> select * from state_list;
ERROR: relation "state_list" does not exist
LINE 1: select * from state_list;
^
db_name=>
Lösung
An ON UPDATE
trigger was changing the parameters.
Use the SET
clause on the CREATE FUNCTION
statement if you need to override search_path
within a function.