On 11/08/13 09:30, Tim Kane wrote: > > Remi, to answer your question - this is being called as part of a shell > script. In that case your options expand greatly... For example: tbl_name="YYYYMM" psql -c "alter table my_table rename to my_table_${tbl_name}_raw;" or for more complex stuff: tbl_name="YYYYMM" psql -f- <<EOF alter table my_table rename to my_table_${tbl_name}_raw; ... <other DML/DDL> EOF Or even: ( <bunch of commands generating SQL DML/DDL> ) | psql -f- Or ... The sky's the limit once you remove the restriction of working 100% *within* psql itself. HTH Bosco. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general