Re: Using the NEW record in an EXECUTE command in a PL/pgSQL trigger function

From: Ali Pouya <alipouya2(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using the NEW record in an EXECUTE command in a PL/pgSQL trigger function
Date: 2013-01-02 13:53:32
Message-ID: CAEEEPmxMSgijhG+CdY=hFUZQqZb21697kq9f5dKmAObOAmZLEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013/1/2 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>

> you forgot USING clause
>
> BEGIN
> EXECUTE 'INSERT INTO measurement1 values(new.*)' USING new;
> -- INSERT INTO measurement1 values(new.*);
> RETURN NULL;
> END;
>
> Regards
>
> Pavel Stehule
>

Hi Pavel,
Thanks for your answer, but it did not work for me (I test on versions
9.1.6 and 9.2.1).

Fortunately I found this solution in the archives :

EXECUTE 'INSERT INTO measurement1 select $1.* ' USING new;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Mennens 2013-01-02 14:30:42 Dedicated PostgreSQL System
Previous Message Pavel Stehule 2013-01-02 13:27:01 Re: Using the NEW record in an EXECUTE command in a PL/pgSQL trigger function