From: | Adarsh Sharma <eddy(dot)adarsh(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Concatenate table name in Pl/Pgsql |
Date: | 2013-06-26 05:07:29 |
Message-ID: | CAGx-QqKQGSh7USi4Y6O5ve6iig0-QBbf=j8dVOi1OQsuGQW=ww@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi ,
Today i m creating a function that includes dynamic concatenation of a
partitioned table name as below :-
test=# CREATE OR REPLACE FUNCTION tmp_trigger_function()
test-# RETURNS TRIGGER AS $$
test$# DECLARE
test$# tbl_name text;
test$# abc varchar;
test$# BEGIN
test$# tbl_name := 'tmp';
test$# select to_char(NEW.a::timestamp,'yyyymmdd') into abc ;
test$# insert into tmp || abc values ( NEW.* );
test$# RETURN NULL;
test$# END;
test$# $$
test-# LANGUAGE plpgsql;
ERROR: syntax error at or near "||"
LINE 9: insert into tmp || abc values ( NEW.* );
^
Time: 0.901 ms
test=#
test=#
I tried with a statement variable also. Any ideas ?
Thanks
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2013-06-26 05:10:04 | Re: Archiving and recovering pg_stat_tmp |
Previous Message | Sameer Thakur | 2013-06-26 04:41:51 | Re: Archiving and recovering pg_stat_tmp |