Re: [GENERAL] PL/pgSQL syntax/usage question - Mailing list pgsql-general

From Ed Loehr
Subject Re: [GENERAL] PL/pgSQL syntax/usage question
Date
Msg-id 38985E7C.FB69801B@austin.rr.com
Whole thread Raw
In response to PL/pgSQL syntax/usage question  (Henk van Lingen <henkvl@cs.uu.nl>)
List pgsql-general
Adriaan Joubert wrote:
>
> >
> > Second, IIRC, you cannot pass in a string representing the tablename
> > and then use it as a tablename in the select (though it would be quite
> > handy).  Not sure how to do it, though.
>
> I went through this a while ago: no way to pass a table name in. Only possibility
> is to write a C routine using SPI and then anything is possible.

It occurs to me that you might be able to weave something together by
looking up the tablename in the pg_class or pg_tables system tables
and then building some sort of select query using the relation ID to
get into the table.  Haven't tried it, don't know if it could work,
but there's an idea for the truly desperate.

Cheers,
Ed Loehr

pgsql-general by date:

Previous
From: Nicolas Huillard
Date:
Subject: RE: [GENERAL] Rebuilding 6.5.3 RPMs
Next
From: Bertrand Bourdon
Date:
Subject: ...