Re: [SQL] Issue with a variable in a function

2011-11-09 Thread tlund79
Thank you for your reply. I've tried that and the function runs OK, my issue then is maybe selecting the function? I've tried both select ppr_pf_inn_antall(2011,1,52,[8,3]) and select ppr_pf_inn_antall(2011,1,52,{8,3}) but none of them runs. I've read up about arrays and functions, but guess

Re: [SQL] Issue with a variable in a function

2011-11-09 Thread tlund79
I solved this one by trial and error. You were right I needed brackets to indicate an array, but also needed to replace "in ($4)" with "= any ($4)" -- View this message in context: http://postgresql.1045698.n5.nabble.com/Issue-with-a-variable-in-a-function-tp4974235p4977361.html Sent from the Pos

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-09 Thread Sylvain Mougenot
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,11,1,,00,"2011-11-07 00:00:00","2011-11-07 00:00:00",,0,0,,0) CONTEXT: PL/pgSQL function "job_insert_trigger" line

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-09 Thread Josh Kupershmidt
On Wed, Nov 9, 2011 at 6:57 AM, Sylvain Mougenot wrote: > 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)? I doubt this is a bug i

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-09 Thread Sylvain Mougenot
As I mentioned before, your code works on special cases (insert with all the columns) and those are very few cases. Try this CREATE TABLE foo (a int, b int); CREATE TABLE job_2011_11 (c int, d int); CREATE OR REPLACE FUNCTION job_insert_trigger() RETURNS TRIGGER AS $BODY$ DECLARE currentT

Re: [SQL] Partitionning + Trigger and Execute not working as expected

2011-11-09 Thread Josh Kupershmidt
On Wed, Nov 9, 2011 at 4:39 PM, Sylvain Mougenot wrote: > As I mentioned before, your code works on special cases (insert with all the > columns) and those are very few cases. > Try this > CREATE TABLE foo (a int, b int); > CREATE TABLE job_2011_11 (c int, d int); > > CREATE OR REPLACE FUNCTION jo