Re: Accessing RECORD variable info

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org, "Derrick Betts" <list(at)blueaxis(dot)com>
Subject: Re: Accessing RECORD variable info
Date: 2007-02-04 17:56:13
Message-ID: 20295.1170611773@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Andreas Kretschmer <akretschmer(at)spamfence(dot)net> writes:
> Derrick Betts <list(at)blueaxis(dot)com> schrieb:
>> How can I determine the actual field name and the field value for the record
>> variable (rec) if I were to look in index 1 or 2 or 3 of the variable?

> Unfortunately you can't access to row-index, you need the name of the
> column.

plpgsql is not designed for that sort of thing; despite the existence of
"record" variables, it's really a strongly typed language and doesn't
cope well with fields of variable data types. Consider using one of the
other PLs instead (plperl, plpython, etc depending on which language you
like best). Most of them can handle this easily.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Greg Quinn 2007-02-04 18:15:33 If Statement
Previous Message Tom Lane 2007-02-04 17:45:21 Re: connection timeout?