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

Re: field incrementing in a PL/pgSQL trigger

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: tvadnais(at)earthlink(dot)net
Cc: "Postgres General List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: field incrementing in a PL/pgSQL trigger
Date: 2004-10-28 17:18:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
"Tim Vadnais" <tvadnais(at)earthlink(dot)net> writes:
> My questions are: Is there a way I can dynamically determine the number of
> fields in the rows that is being maintained.

I'm starting to think there should be a FAQ entry for this ;-)

plpgsql is essentially incapable of doing anything that involves dynamic
field access, especially if the field types aren't known in advance either.
I believe you can do what you want in pltcl, and you can definitely
write such a trigger in C, but plpgsql is the wrong tool for the job.

If you want to try it in C, there are some relevant examples in
contrib/spi/ in the PG source distribution.

			regards, tom lane

In response to

pgsql-general by date

Next:From: Bruno Wolff IIIDate: 2004-10-28 17:20:09
Subject: Re: '1 year' = '360 days' ????
Previous:From: Tom LaneDate: 2004-10-28 17:07:21
Subject: Re: Question Regarding Locks

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