Postgres 8.4 and greater databases contain common tables in public
schema and company specific tables in company
schema.
company
schema names always start with 'company'
and end with the company number.
So there may be schemas like:
public
company1
company2
company3
...
companynn
An application always works with a single company.
The search_path
is specified accordingly in odbc or npgsql connection string, like:
search_path="company3,public"
How would you check if a given table exists in a specified companyn
schema?
eg:
select isSpecific('company3','tablenotincompany3schema')
should return false
, and
select isSpecific('company3','tableincompany3schema')
should return true
.
In any case, the function should check only companyn
schema passed, not other schemas.
If a given table exists in both public
and the passed schema, the function should return true
.
It should work for Postgres 8.4 or later.