Reading up on 'Exit Status' section in
http://www.postgresql.org/docs/8.3/static/app-psql.html shows that it will
return 3 if ON_ERROR_STOP was set, and it was run using a script.

So I guess you need to do it as:

my $psql_cmd = "PGPASSWORD=" . $password . " psql -U " .
$user . " -h " . $host . " " . $database . " -v ON_ERROR_STOP= -f " .
$schema_deploy_file;

HTH,

Best regards,

On Fri, Jan 30, 2009 at 1:31 AM, Devan Goodwin <[email protected]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Working on the population of PostgreSQL schema in
> spacewalk-setup I landed in rhn-populate-database.pl, got the
> script ready to populate pgsql schema as well but even if the
> schema population fails miserably, the psql executable returns a
> 0 success code.
>
> Anyone have ideas for a good way to progrematically check if the
> population was successful?
>
> For the record the population code looks like:
>
> my $psql_cmd = "PGPASSWORD=" . $password . " psql -U " .
> $user . " -h " . $host . " " . $database . " < " . $schema_deploy_file;
> $pid = open3(gensym, ">&LOGFILE", ">&LOGFILE", $psql_cmd);
>
> Thanks,
>
> Devan
>
> - --
>  Devan Goodwin <[email protected]>
>  Software Engineer     Spacewalk / RHN Satellite
>  Halifax, Canada       650.567.9039x79267
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
>
> iEYEARECAAYFAkmCCycACgkQAyHWaPV9my7m+wCgsBixKLS4PIhCEJtLiK7P0yHq
> TlYAn3ofYMCEA5Jms6HwK1GPuG9YkEM9
> =JkFW
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Spacewalk-devel mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/spacewalk-devel
>



-- 
gurjeet[[email protected]
EnterpriseDB      http://www.enterprisedb.com

singh.gurj...@{ gmail | hotmail | indiatimes | yahoo }.com
_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to