From: | Sylvain Mougenot <smougenot(at)sqli(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Partitionning + Trigger and Execute not working as expected |
Date: | 2011-11-09 11:57:34 |
Message-ID: | CACKdPFgTuvUFHoG-qhZh3UZY=JG8M5eMnL_q2gmWK_nh2xWoAg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Thank you for the help.
But it doesn't work :
EXECUTE 'INSERT INTO '|| currentTableName || ' values ' || (NEW.*);
QUERY: INSERT INTO job_2011_11 values
(117916386,-5,,2,2,1,,,,1,1,,0,,,,,,,,0,"2011-11-07 00:00:00","2011-11-07
00:00:00",,0,0,,0)
CONTEXT: PL/pgSQL function "job_insert_trigger" line 9 at instruction
EXECUTE
It looks like the NULL values are blanks in the generated query.
Using the query below produces an error too
EXECUTE 'INSERT INTO '|| currentTableName || ' values (NEW.*)';
ERREUR: missing FROM clause for table « new »
SQL :42P01
QUERY: INSERT INTO job_2011_11 values (NEW.*)
CONTEXT: PL/pgSQL function "job_insert_trigger" line 9 at instruction
EXECUTE
Even if the query below is fine (the exact content I try to build as a
String to use with EXECUTE)
INSERT INTO job_2011_11 values (NEW.*)
Is there a way to solve this?
Isn't it a bug (in how EXECUTE works)?
On Wed, Nov 9, 2011 at 1:35 AM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
> On Tue, Nov 8, 2011 at 11:04 AM, Sylvain Mougenot <smougenot(at)sqli(dot)com>
> wrote:
> > EXECUTE 'INSERT INTO '|| currentTableName || ' values (NEW.*)';
>
> The quotes in the above line are wrong; you want it like:
>
> EXECUTE 'INSERT INTO '|| currentTableName || ' values ' || (NEW.*);
>
> Josh
>
--
Sylvain Mougenot
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Kupershmidt | 2011-11-09 19:25:05 | Re: Partitionning + Trigger and Execute not working as expected |
Previous Message | tlund79 | 2011-11-09 10:41:39 | Re: Issue with a variable in a function |