pypi peewee 4.2.3

6 hours ago
1658422182493101

Bug hunt wrapped up!

These were all pretty far out there on the edge of edge-cases. Things are looking solid all around.

  • Fix a compound select (UNION/INTERSECT/EXCEPT) used as a correlated subquery emitting a phantom alias for the correlated outer table in every branch but the left-most, producing invalid SQL (e.g. no such column: t4.id). The right-hand branch renders in a fresh alias scope that no longer resolved the outer source's existing alias, it now inherits the enclosing scope's aliases while still assigning fresh aliases to its own sources.
  • Fix full-text search weights passed as a dict being mis-applied to the wrong columns. For FTS3/4 the implicit docid primary-key was included when building the weight list, shifting every column by one (raising IndexError with the Python ranking UDF, silently mis-scoring with the Cython one), for FTS5, UNINDEXED columns were skipped even though bm25() weights are positional across all columns. The list form of weights was unaffected.
  • Fix .cte() clearing the source query's CTE list in place: converting a query that carried a with_cte(...) clause into a CTE stripped the clause from that query, so reusing it afterward referenced an undeclared CTE. The query is now cloned before its CTE list is reset.
  • Fix Table.select() with no arguments on a Table declared without columns emitting an empty projection (SELECT FROM ...) instead of SELECT *.
  • Fix Table.insert(select_query) with no columns raising TypeError instead of rendering INSERT INTO t SELECT ....
  • Fix the MySQL migrator dropping a foreign key's ON DELETE/ON UPDATE action when add_not_null() or rename_column() rebuilds the constraint, silently downgrading e.g. CASCADE to RESTRICT. The actions reported by get_foreign_keys() are now carried through to the rebuilt constraint.
  • Fix the legacy postgres_ext JSON contains/contained_by/concat raising AttributeError, and remove() silently rewriting the entire column, when applied to a .path()-chained lookup (e.g. Model.data['a'].path('b')). All four now resolve the root field and full path via _resolve_root(), matching the sibling set/replace/insert/append/update mutators.
  • Correct the postgres_ext.JSONField docs: the json-column field does not support the jsonb-based mutation/concatenation builders (they raise ProgrammingError), so the misleading "Postgres casts implicitly" claim was removed and new code is steered to the built-in JSONField.
  • Fix the SQLite migrator treating a bare table-level UNIQUE (a, b) constraint as a column when rebuilding a table (add_not_null, drop_column, ...), raising no column named UNIQUE; unique is now recognized as a constraint.
  • Fix the SQLite migrator's table rebuild corrupting the CREATE TABLE keywords for a table whose name is a case-insensitive substring of them (e.g. ab, t, tab) -- the table-name substitution is now anchored to the trailing name token.

View commits

Don't miss a new peewee release

NewReleases is sending notifications on new releases.