We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


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

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 "xxx.xxx" 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 ?

Thanks

Comments

  • DaveTDaveT Vertica Employee Employee

    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:
    https://forum.vertica.com/discussion/239932/exiting-a-vsql-script-following-an-error

Leave a Comment

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