Fix Postgres array syntax for UPDATE #644
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR should address #579 by formatting
UPDATE
queries using the same rules asINSERT
queries. Regression tests for the new case have been added, courtesy of @vfonte91.A side effect of this fix is that I discovered PyPika has inconsistent handling of
null
versusNULL
. In these queries,null
is used:But in these queries,
NULL
is used:This is because there are two different code paths for formatting null values:
pypika/pypika/terms.py
Line 385 in a7b01da
pypika/pypika/terms.py
Line 479 in a7b01da
Both of these code paths used to return lowercase
null
circa 2018; this was changed in a seemingly unrelated commit 3bfee98.Some other keywords (
true
,false
) seem to be lowercase by convention in PyPika, whereas others (SYSTEM_TIME
) seem to be uppercase by convention, so it's not entirely clear to me what the expected standardization is. On the plus side, since SQL is fully case-insensitive, it doesn't really matter too much.In this PR, I've updated all code paths and tests to use lowercase
null
. Let me know if that's wrong.