Skip to content

Fix end unconditionally decrementing the split level, but case not incrementing it in a plain select#839

Open
lorenzhs wants to merge 1 commit intoandialbrecht:masterfrom
lorenzhs:fix/end-level
Open

Fix end unconditionally decrementing the split level, but case not incrementing it in a plain select#839
lorenzhs wants to merge 1 commit intoandialbrecht:masterfrom
lorenzhs:fix/end-level

Conversation

@lorenzhs
Copy link

Fixes inconsistent level handling of CASE ... END:

  • CASE only sets the _in_case flag and returns a +1 level diff if it's in a CREATE statement
  • the matching END unconditionally decreases the level

This led to the level being one lower than it should have been after the CASE WHEN ... END block.

The way this caused trouble was in splitting: combined with some escaping trouble (#838) this led to a query incorrectly being split into two.

Checklist:

  • ran the tests (pytest)
  • all style issues addressed (flake8)
  • your changes are covered by tests
  • your changes are documented, if needed

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

Successfully merging this pull request may close these issues.

1 participant