From: | "Little, Doug C" <Doug(dot)Little(at)vend(dot)frb(dot)org> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | psql sqlstate return code access |
Date: | 2015-03-16 15:23:04 |
Message-ID: | DD0B11E67A9F2045AC02E1CFD7771C67ED5E96@NR1PWPGLCD1C.rb.win.frb.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Richardson | 2015-03-16 16:02:32 | Update using non-existent fields does not throw an error |
Previous Message | Ruth Melendo | 2015-03-16 14:51:47 | how to recovery your database when stops replicating |
From | Date | Subject | |
---|---|---|---|
Next Message | Luca Ferrari | 2015-03-16 17:23:37 | Re: psql sqlstate return code access |
Previous Message | Felipe Santos | 2015-03-11 16:25:17 | Re: psql -L log errors |