Re: How to access NEW or OLD field given only the field's name?

From: François Beausoleil <francois(at)teksol(dot)info>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Forums postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to access NEW or OLD field given only the field's name?
Date: 2014-03-20 13:06:20
Message-ID: EFF10A72-25BB-4D91-8ADD-367C66074942@teksol.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Le 2014-03-19 à 19:48, Adrian Klaver a écrit :

> On 03/19/2014 02:01 PM, François Beausoleil wrote:
>
> Some experimenting showed that NEW.* does not work. So plan B:
>
>
> EXECUTE 'SELECT $1.' || TG_ARGV[0] || INTO total USING NEW;
> RAISE EXCEPTION 'Total: %, social_impressions: %', total,

Thank you, Adrian. I've accepted the following answer on StackExchange: http://dba.stackexchange.com/a/61304/3935

It's your solution, but with the extra call to format, preventing SQL injection attacks.

Thanks!
François

In response to

Browse pgsql-general by date

  From Date Subject
Next Message José Pedro Santos 2014-03-20 13:35:55 Re: Dump Database
Previous Message basti 2014-03-20 12:48:47 Backup WAL Replication Server