Re: access computed field of RECORD variable

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Steve White <swhite(at)aip(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: access computed field of RECORD variable
Date: 2010-01-05 14:13:49
Message-ID: 20100105141349.GD3660@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve White wrote:

> The roadblock is:
>
> There is a record, which may be from any of a set of similar databases.
> Field names for this record are computed as strings. Using these strings,
> I need to access fields of the record.
>
> But I can't find the syntax for it.

You can't do this with plpgsql. There are some limited possibilities
with "EXECUTE 'foo bar $1 baz' USING rec" where the $1 is expanded with
the record. However the best thing you can do is use a different PL,
probably PL/Perl.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2010-01-05 14:24:58 Re: Shall I use PostgreSQL Array Type in The Following Case
Previous Message Alvaro Herrera 2010-01-05 14:08:11 Re: Looking for advice on working with revisions