Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

Next:From: Greg QuinnDate: 2007-02-04 18:15:33
Subject: If Statement
Previous:From: Tom LaneDate: 2007-02-04 17:45:21
Subject: Re: connection timeout?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group