from string to table...?

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: from string to table...?
Date: 2001-03-23 06:57:51
Message-ID: 20010323005751.A16314@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

let's say you have the name of a table in a string.

'mytable'

you also have field names, such as

'lookupfield' 'valuefield'

which would be assembled like this

select valuefield from mytable where lookupfield = '?'

is there a way to write sql/plpgsql that'll take a varchar
argument (table and field names) and be able to turn it into the
appropriate query?

i can see pg_class contains table info and pg_attribute has info
for the fields ... is there a way (oids maybe?) to direct
postgres to the right table for a search, given the name of the
table in a varchar string? (and if so, how? :)

--
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
-- Isaac Asimov, 'The Genetic Code'

will(at)serensoft(dot)com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2001-03-23 07:11:18 Re: Re: Call for platforms
Previous Message Thomas Lockhart 2001-03-23 06:31:43 Re: Call for platforms