Обсуждение: control function pgsql with script bash

Поиск
Список
Период
Сортировка

control function pgsql with script bash

От
manuel antonio ochoa
Дата:
Good morning <br /><br />I want to check  if the function pgsql  execute correctly  into my bash script .<br />I have
somethinglike this : <br /><br />/var/lib/pgsql/bin/./psql -U 'USER'   -d DATABSE  -p 5432 -h  iphost   -c  "select 
antros.changethenames()"<br /><br />how can i get the error if the function changethenames() send me one. ? <br /><br
/>thnks<br /><br /><br /> 

Re: control function pgsql with script bash

От
Joshua Tolley
Дата:
On Tue, Jan 25, 2011 at 10:46:58AM -0600, manuel antonio ochoa wrote:
> Good morning
>
> I want to check  if the function pgsql  execute correctly  into my bash
> script .
> I have something like this :
>
> /var/lib/pgsql/bin/./psql -U 'USER'   -d DATABSE  -p 5432 -h  iphost   -c
> "select  antros.changethenames( )"
>
> how can i get the error if the function changethenames() send me one. ?
>
> thnks

See http://www.postgresql.org/docs/9.0/static/app-psql.html#AEN74212

Turn on ON_ERROR_STOP, and psql will give you an exit status of 3 when
something goes wrong in your script. I don't know of a way, aside from parsing
the output, that you can identify exactly where the problem arose.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com