Re: Partitionning + Trigger and Execute not working as expected
От | Sylvain Mougenot |
---|---|
Тема | Re: Partitionning + Trigger and Execute not working as expected |
Дата | |
Msg-id | CACKdPFgTuvUFHoG-qhZh3UZY=JG8M5eMnL_q2gmWK_nh2xWoAg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Partitionning + Trigger and Execute not working as expected (Josh Kupershmidt <schmiddy@gmail.com>) |
Ответы |
Re: Partitionning + Trigger and Execute not working as expected
|
Список | pgsql-sql |
Thank you for the help.
--
Sylvain Mougenot
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@gmail.com> wrote:
On Tue, Nov 8, 2011 at 11:04 AM, Sylvain Mougenot <smougenot@sqli.com> wrote:The quotes in the above line are wrong; you want it like:
> EXECUTE 'INSERT INTO '|| currentTableName || ' values (NEW.*)';
EXECUTE 'INSERT INTO '|| currentTableName || ' values ' || (NEW.*);
Josh
Sylvain Mougenot
В списке pgsql-sql по дате отправления: