sqlite3: no NULLS FIRST

sqlite3 added NULLS FIRST to their schema as of v3.30.1 but some older
boxes aren't updated (notably the author's own node box).

The default behavior for sqlite3 is to sort nulls first however, this
is *really* only needed for postgres.

As a simple fix (which will allow older boxes to not upgrade their
sqlite yet), simply strip out the NULLS FIRST keywords from sqlite3
queries.

Reported-By: Simon Vrouwe @SimonVrouwe
Fixes: #5517
This commit is contained in:
niftynei
2022-08-15 14:38:46 -05:00
committed by neil saitug
parent 4e7f89f211
commit fdfca9e721

View File

@@ -51,6 +51,8 @@ class Sqlite3Rewriter(Rewriter):
r'decode\((.*),\s*[\'\"]hex[\'\"]\)': 'x\\1',
# GREATEST() of multiple columns is simple MAX in sqlite3.
r'GREATEST\(([^)]*)\)': "MAX(\\1)",
# NULLS FIRST is default behavior on sqlite, make it disappear
r' NULLS FIRST': '',
}
return self.rewrite_types(query, typemapping)