psql sqlstate return code access

Поиск
Список
Период
Сортировка
От Little, Doug C
Тема psql sqlstate return code access
Дата
Msg-id DD0B11E67A9F2045AC02E1CFD7771C67ED5E96@NR1PWPGLCD1C.rb.win.frb.org
обсуждение исходный текст
Ответы Re: psql sqlstate return code access  (Luca Ferrari <fluca1978@infinito.it>)
Список pgsql-general

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

 

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ruth Melendo"
Дата:
Сообщение: how to recovery your database when stops replicating
Следующее
От: Rob Richardson
Дата:
Сообщение: Update using non-existent fields does not throw an error