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@gmail.com> wrote:
On Tue, Nov 8, 2011 at 11:04 AM, Sylvain Mougenot <
smougenot@sqli.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