Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WHENEVER SQLERROR EXIT SQL.SQLCODE is not safe on UNIX #831

Open
vectro opened this issue Jun 3, 2024 · 3 comments
Open

WHENEVER SQLERROR EXIT SQL.SQLCODE is not safe on UNIX #831

vectro opened this issue Jun 3, 2024 · 3 comments

Comments

@vectro
Copy link
Contributor

vectro commented Jun 3, 2024

On Oracle, Sqitch runs the SQL*Plus command WHENEVER SQLERROR EXIT SQL.SQLCODE, so that we can detect errors. However, on UNIX, SQL*Plus will return the actual error code modulo 256, which means the application can return zero exit status if the error code is a multiple of 256.

For example, if Sqitch tries to deploy a script creating a table with too many columns, causing error ORA-01792: maximum number of columns in a table or view is 1000, SQL*Plus will still exit with zero exit status (because 1792 mod 256 = 0), so Sqitch will not detect the error.

@theory
Copy link
Collaborator

theory commented Jun 6, 2024

Oh man, that's wild. Would WHENEVER SQLERROR EXIT FAILURE fix it? The Exasol engine uses WHENEVER SQLERROR EXIT 4 instead. I have no clue what's right for either of these cases TBH 😂

@vectro
Copy link
Contributor Author

vectro commented Jun 8, 2024

It seems that on UNIX at least, FAILURE gives an exit status of 1. I think that would fix this bug.

@theory
Copy link
Collaborator

theory commented Jun 9, 2024

This is wild. Maybe should do EXIT 4, if only because in some places Sqitch thinks of error code 1 as more of a warning. Not as much as it used to, but still…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants