Error Handling

Moderator: NorbertKrupa

Post Reply
Posts: 16
Joined: Fri Aug 09, 2013 7:10 pm

Error Handling

Post by ClevelandSteve » Mon Feb 10, 2014 3:48 pm

I run a lot of procedures through the command line. I’m working on improving my error handling techniques as I have had some minor things fall through the cracks lately. The Vertica 6.1 Programmers Guide states the following when working with the command line:
vsql returns the following informational messages:
0 to the shell if it finished normally
1 if a fatal error of its own (out of memory, file not found) occurs
2 if the connection to the server went bad and the session was not interactive
3 if an error occurred in a script and the variable ON_ERROR_STOP was set
So in order to see this actually work I wrote a small test:

Code: Select all


set -e # If a command returns a non-zero exitcode, terminate the shell with an error.

source /opt/vertica/load/scripts/vertica_load.cfg

$VSQL -d $VSQL_DBNAME -U $VSQL_USERNAME -w $VSQL_PASSWORD -f error_testing.sql
echo $?

exit 0
The file error_testing.sql does not exist, so according to the documentation I would expect an error 1 file not found to be returned to the shell. Here is the console output:
executing script: /opt/vertica/load/scripts/vertica_db/error_testing
error_testing.sql: No such file or directory
[SSH] exit-status: 0
Finished: SUCCESS
As expected I get the no such file or directory error, but it has an exit-status 0. Shouldn’t that be an exit-status 1? What am I missing here?
Last edited by ClevelandSteve on Mon Feb 10, 2014 7:25 pm, edited 1 time in total.

Post Reply

Return to “Vertica External Procedures”