Search Postgresql Archives

psql sqlstate return code access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux