From: | "Joel Burton" <joel(at)joelburton(dot)com> |
---|---|
To: | "Pgsql-Hackers(at)Postgresql(dot) Org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Exposed function to find table in schema search list? |
Date: | 2002-05-19 21:00:54 |
Message-ID: | AHEDLOKJMIPAGOHCCBCDGEBJCBAA.joel@joelburton.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I'm writing a function that accepts a table name and digs some information
out about it. I'm developing on 7.3cvs w/schemas, and wanted my function to
use schemas.
If the user gives a full schema name (s.table), I find the table in pg_class
by comparing the ns oid and relname.
However, if the user doesn't give the full schema name, I have to find which
table they're looking for by examining current_schemas, iterating over each
schema in this path, and trying it.
Is there a function already in the backend to return a class oid, given a
name, by looking up the table in the current_schemas path? Would it make
sense for us to expose this, or write one, so that this small wheel doesn't
have to be re-invented everytime someone wants to find a table by just the
name?
Something like:
findtable(text) returns oid
findtable("foo") -> oid of foo (given current search path)
findtable("s.foo") -> oid of s.foo
I can write something in plpgsql (iterating over the array, checking each,
etc.), however, it would be nice if something was already there.
Any ideas?
Thanks!
- J.
Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-05-19 21:22:34 | Re: [PATCHES] SRF patch (was Re: troubleshooting pointers) |
Previous Message | Joe Conway | 2002-05-19 20:55:42 | Re: SRF patch (was Re: [HACKERS] troubleshooting pointers) |