Search Postgresql Archives

Problem Changing search_path in pgTAP tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.  I am running into a problem when trying to run pgTAP tests.  Basically, there are two functions with the same name in different 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 the search 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.  There are 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 still what gets run.  A print statement confirms that D1 is being run, and that, in the function D1, the search path includes S2, 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 in turn 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 there to reproduce the issue, others are there to show control cases where the problem doesn't happen.  I won't post it here in case attachements don't come through correctly, but if anyone is interested please let me know and I will be happy to 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
-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux