Re: [GENERAL] psql sqlstate return code access

2015-03-16 Thread Luca Ferrari
On Mon, Mar 16, 2015 at 4:23 PM, Little, Doug C 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/plpgs

[GENERAL] psql sqlstate return code access

2015-03-16 Thread Little, Doug C
Hi, I have a requirement to log into a table the completion code for each statement being submitted in a psql script. I've looked around and can't seem to find how to access the sqlstate completion code. Is there a system variable in psql available or some other trick to get it? For exam