pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
control function pgsql with script bash
2+ messages / 2 participants
[nested] [flat]

* control function pgsql with script bash
@ 2011-01-25 16:46  manuel antonio ochoa <manuel8aalfaro@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: manuel antonio ochoa @ 2011-01-25 16:46 UTC (permalink / raw)
  To: pgsql-sql

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: control function pgsql with script bash
@ 2011-01-25 17:05  Joshua Tolley <eggyknap@gmail.com>
  parent: manuel antonio ochoa <manuel8aalfaro@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Joshua Tolley @ 2011-01-25 17:05 UTC (permalink / raw)
  To: manuel antonio ochoa <manuel8aalfaro@gmail.com>; +Cc: pgsql-sql

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

Attachments:

  [application/pgp-signature] signature.asc (196B, ../../4d3f02f3.c9e82a0a.3c9a.6881@mx.google.com/2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-01-25 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 16:46 control function pgsql with script bash manuel antonio ochoa <manuel8aalfaro@gmail.com>
2011-01-25 17:05 ` Joshua Tolley <eggyknap@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox