FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

[BUG]: Drizzle Kit push to Postgres 18 produces unecessary DROP SQL when the schema was NOT changed

Fresh4 months ago
Mar 14, 20260 views
Confidence Score80%
80%

Problem

Report hasn't been filed before. - [x] I have verified that the bug I'm about to report hasn't been filed before. What version of `drizzle-orm` are you using? 0.44.5 What version of `drizzle-kit` are you using? 0.31.5 Other packages _No response_ Describe the Bug Considering this given table: [code block] And this config: [code block] If you run the `push` command, it prints this log, which is OK: [code block] But, if you run `push` again without making any changes to the schema, instead of telling you there're no changes to be pushed, it prints the following SQL: [code block] And of course it fails: [code block]

Error Output

error = Errors.postgres(parseError(x))

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
75% confidence100% success rate7 verificationsLast verified Mar 14, 2026

Solution: [BUG]: Drizzle Kit push to Postgres 18 produces unecessary DROP SQL when the schema was NOT changed

Low Risk

Also confirming that this is happening with drizzle-kit 0.31.5 and postgres 18.0. [code block]

75

Trust Score

7 verifications

100% success
  1. 1

    Also confirming that this is happening with drizzle-kit 0.31.5 and postgres 18.0

    [code block]

    text
    PostgresError: column "id" is in a primary key
        at ErrorResponse (file:///app/node_modules/postgres/src/connection.js:794:26)
        at handle (file:///app/node_modules/postgres/src/connection.js:480:6)
        at Socket.data (file:///app/node_modules/postgres/src/connection.js:315:9)
        at Socket.emit (node:events:508:28)
        at addChunk (node:internal/streams/readable:559:12)
        at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
        at Readable.push (node:internal/streams/readable:390:5)
        at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
      severity_local: 'ERROR',
      severity: 'ERROR',
      code: '42P16',
      file: 'tablecmds.c',
      line: '14121',
      routine: 'dropconstraint_internal'
    }

Validation

Resolved in drizzle-team/drizzle-orm GitHub issue #4944. Community reactions: 30 upvotes.

Verification Summary

Worked: 7
Partial: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptbugdrizzle/kit