Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

VSQL command does not return exit code -1 even if it fails internally

I have a use-case where i am executing .vsql query using VSQL Client . Even if the query fails for whatever reason for example -
ERROR 4568: Relation "" does not exist

Still it is returning exit status 0 which is incorrect , could anyone please tell me what is the solution to handle this ?



  • If you are using "vsql -c" then you should get an exit code of 1 for the single statement that failed. If you are using something like "vsql << eof" to run multiple statements then you can use "\set ON_ERROR_STOP on" or \set ON_ERROR_STOP off" depending on whether you want the script to fail or not at that point. While ON_ERROR_STOP is toggled to "on" vsql will terminate on a SQL statement error and you will get an exit code of 3. There was a Vertica tip just shared on the use of ON_ERROR_STOP:

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.