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 example insert into x select … from y; insert into log(message, code,timestamp) values('insert into x',:SQLSTATE,now()); where :SQLSTATE contains the completion code of the prior statement.
Thanks in advance Doug Little |