On Mon, Mar 16, 2015 at 4:23 PM, Little, Doug C <Doug.Little@xxxxxxxxxxxx> wrote: > insert into x select … from y; > > > > insert into log(message, code,timestamp) values('insert into > x',:SQLSTATE,now()); > > I'm pretty sure you have to wrap it into a plpgsql function: http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html Moreover, if the command executes correctly you would have no exception and sql state will be 0. Hope this helps. Luca -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general