Skip to content

Sequelize issues fixed in postgrelize ​

Open issues of sequelize/sequelize that affect Sequelize v6 on PostgreSQL, checked against postgrelize (review of 73 issues, 2026-11-14). Fixes made in postgrelize and the v6 parity items have regression tests in this repository; the "works correctly" list was verified with reproduction scripts run on both libraries at review time.

Bugs fixed in postgrelize (Sequelize v6 still affected) ​

These fixes intentionally differ from Sequelize v6 (ADR-016).

IssueFixed behaviour
#18617JSON where keys with ,, " or \ are matched correctly
#5173jsonb operators (Op.contains, Op.hasKey, …) on nested JSON paths
#16043{ [Op.any]: [...] } shorthand
#14497upsert with overriding on GENERATED ALWAYS identity columns
#12595upsert on a partial unique index uses its predicate
(no issue) createTrigger function argumentsArguments are rendered as literals (EXECUTE FUNCTION f('a', 1)); v6 rendered typed parameter declarations, which PostgreSQL rejects
#16787describeTable unquotes literal defaults ('it''s', 'x::y')
#13167sync({ alter }) keeps the sequence of non-key autoIncrement columns
#18423sync({ schema }) / drop({ schema }) work in that schema only
#18256belongsToMany with a custom sourceKey and limit
#12971top-level $include.attr$ condition with a hasMany include and limit
—describeTable reads enum values of the column's type in its own schema, in declared order (v6 matches the type name in any schema)
—Model.aggregate validates the function name (v6 inserts it into SQL unchecked)
—transaction({ isolationLevel }) accepts only ISOLATION_LEVELS values (v6 inserts it into SQL unchecked)
—bulkCreate({ ignoreDuplicates }) assigns returned rows to the records that were inserted (v6 mixes them up)
—Nested create with a built instance as a child (Post.create({ Comments: [Comment.build()] }, { include })) saves and links it (v6 silently drops the child)

Works correctly in postgrelize ​

IssueTitleKind
#18379Sync fails when multiple schemas contain same-named tablebug
#18362PG column queries parse generated SQLbug
#18320Normalize generated-column expressions in alter drift detectionbug
#18306Op.in: [] emits IN (NULL), Op.not around it returns 0 rowsbug
#17806Postgres join with schema errorsbug
#17769upsert not returning PK for concurrent duplicatesbug
#17570findOrCreate breaks logical replication (temp function DDL)bug
#17544ENUM('PREFERENCES') parsed as REFERENCESbug
#17455upsert returns wrong ID for an existing rowbug
#17435undefined in JSON fields breaks change detectionbug
#17288describeTable fails with column comments + same table in two schemasbug
#16445getForeignKeyReferencesForTable does not filter by schemabug
#16404bulkCreate updateOnDuplicate with UUID PK makes bad SQLbug
#16239bulkCreate wrong ON CONFLICT target for composite PKbug
#15883Crash when the connection failsbug
#15860Cloning ARRAY fails with scopesbug
#15543Index not created when table exists in another schemabug
#15058upsert second element is always nullbug/docs
#14750Returning values after deletefeature
#13184Model.drop() throws without optionsbug
#12961sync({alter}) duplicates FKs with schemasbug
#12718VIRTUAL/GENERATED STORED columnsfeature
#12654NOWAIT in SELECT FOR UPDATEfeature
#12612IS [NOT] DISTINCT FROMfeature
#12382returning on Model.destroy()feature
#11749Missing ::VARCHAR[] cast for Op.contains via $nested$bug
#11748Can't update a row with an empty arraybug
#11671JSONB ? operatorfeature
#11656ON CONFLICT DO UPDATE with WHEREfeature
#11223bulkCreate updateOnDuplicate: no PK for new rowsbug
#11204bulkCreate ignores trigger-set valuesbug
#10966bulkCreate returns Literal for literal defaultsbug
#10952removeIndex with schemabug
#10710upsert broken with literal('uuid_generate_v4()') defaultbug
#10533SUM returns stringbug
#10435Ambiguous column with JOIN + GROUP BYbug
#9853AVG not properly averagingbug
#9635changeColumn does not drop NOT NULLbug
#9565JSONB keys replaced with column namesbug
#7941Concurrent findOrCreate fails with comma in unique valuebug
#5475SELECT DISTINCT ONfeature
#4900INTERVAL data typefeature
#3000Datetimes wrong with TIMESTAMP WITHOUT TIME ZONEbug

Matches Sequelize v6 6.37 (fixed upstream, verified here) ​

IssueBehaviour
#13734upsert / updateOnDuplicate conflict target from unique indexes
#10419explicitly declared createdAt / updatedAt attributes
#17486upsert keeps a supplied updatedAt
#15466ARRAY(ENUM) values returned as arrays
#11100findOrCreate returns ARRAY(ENUM) as an array
#15522sync() with foreign-key cycles
#17118addColumn keeps the column comment
#9040order by a JSON path; numbers sort numerically

Intentional differences from Sequelize v6 ​

  • Foreign-key cycles: v6 creates the tables without the cyclic foreign keys; postgrelize creates both constraints after all tables exist.
  • order: ['json.path']: v6 orders the text value (10, 100, 9); postgrelize orders the jsonb value (9, 10, 100).
  • upsert with timestamp attributes mapped to another field: v6 overwrites supplied values with now; postgrelize keeps them.
  • $include.attr$ in a top-level where together with limit: postgrelize turns the limit subquery off (as subQuery: false) instead of producing invalid SQL; limit then counts joined rows.
  • describeTable returns unquoted literal defaults (it's instead of its).

Known, not fixed ​

  • #16929 literal() increments through upsert: inherent to the v6 upsert API. Use the onConflict option with literal('"T"."balance" + EXCLUDED."balance"') in action.update.
  • #11968 upsert does not restore soft-deleted paranoid rows (same as v6).
  • #11288 ordering by an included hasMany column with limit (same SQL as v6).
  • #12948 memory leak report: not reproduced.
  • #11146 the same association included twice under one alias (separate: false and separate: true) is not merged or rejected.
  • v6 public names postgrelize lacks (statics such as Sequelize.STRING or the error classes, hook shorthands, some Model and QueryInterface methods) are tracked by a test against sequelize@6 and listed in API differences; the list only shrinks.
  • Not implemented v6 options: searchPath, create({ ignoreDuplicates }), named / shared ENUM types.

Released under the MIT License.