Francisco Reyes <lists@stringsutils.com> writes:
> v_sql := 'INSERT INTO messagecatalog_'||
> to_char(NEW.timestampfield,'YYYY')||
> '(field1, field2) values ('
> ||New.field1||','||New.field2||')
> ')';
> EXECUTE v_sql;
This is not a particularly good way of accomplishing partitioning,
as you'll be needing *every* part of your application to be explicitly
aware of the exact partitioning scheme.
However, if you insist on doing it like that, don't you need
quote_literal() for the field values?
regards, tom lane