Problem Changing search_path in pgTAP tests
От | Scott Sturdivant |
---|---|
Тема | Problem Changing search_path in pgTAP tests |
Дата | |
Msg-id | 1B086912-1690-4302-AB6C-8A2EF3193EEA@suran.com обсуждение исходный текст |
Список | pgsql-general |
Hi. I am running into a problem when trying to run pgTAP tests. Basically, there are two functions with the same name indifferent schemas, and I'm trying to get different versions at different times by modifying the search_path. However,there seems to be a case where postgres is caching the functions, causing it to find the wrong function after thesearch path has been changed. Here is a more detailed description - There are two pgTAP tests, A and B. They both run the same function in the public schema, C. C runs a function D. Thereare two versions of D (D1 and D2), in two different schemas (S1 and S2). Test A sets the search path to include S1, but not S2, so when C runs, it should run D1, not D2. This works correctly. Test B sets the search path to include S2, but not S1, so when C runs, it should run D2, not D1. In this case, D1 is stillwhat gets run. A print statement confirms that D1 is being run, and that, in the function D1, the search path includesS2, but not S1. It will work correctly if A and B just attempt to run D directly. This problem only happens when A and B run C, which inturn runs D. This problem also won't occur if some function runs D, changes the search path, and runs D again. I have a small database that will reproduce this issue. It contains 7 functions (and the pgTAP functions) - some are thereto reproduce the issue, others are there to show control cases where the problem doesn't happen. I won't post it herein case attachements don't come through correctly, but if anyone is interested please let me know and I will be happyto email it directly to you. We are running on Postgres 8.4.1 on Mac. Also, for anyone not familiar with pgTAP, here is the website - http://pgtap.projects.postgresql.org/ - Scott Sturdivant
В списке pgsql-general по дате отправления: