from string to table...? - Mailing list pgsql-general

From will trillich
Subject from string to table...?
Date
Msg-id 20010323005751.A16314@mail.serensoft.com
Whole thread Raw
Responses Re: from string to table...?
List 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@serensoft.com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Updates on Views?
Next
From: Richard Huxton
Date:
Subject: Re: from string to table...?