payloadcms / payloadcms/payload

Push mode fails with 'type serial does not exist' error when connecting existing database

Open
#14,035 1 comment 2 reactions 1 assignee View on GitHub

@r1tsuu is already working on this.

Since Feb 17, 2026.

Bug stale
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Bug Report

Payload Version: 3.54.0
Database: PostgreSQL (Supabase) via @payloadcms/db-postgres

Description

When enabling push mode in development (push: true in postgresAdapter config), Payload attempts to run an invalid ALTER TABLE query that fails because PostgreSQL doesn't have a type called "serial".

Use Case & Impact

I'm connecting an existing database to Payload CMS and want to benefit from the push feature for rapid development. This bug makes it impossible to use push mode with an existing database, forcing me to use migrations instead - which defeats the purpose of having a push mode for quick iterations during development.

The push feature would be extremely valuable for:

  • Syncing schema changes during development without manual migrations
  • Quickly iterating on the CMS configuration
  • Avoiding the overhead of migration files for every small change
Error Message
[Error: Failed query: ALTER TABLE "_products_v_rels" ALTER COLUMN "id" SET DATA TYPE serial;
params: ] {
  query: 'ALTER TABLE "_products_v_rels" ALTER COLUMN "id" SET DATA TYPE serial;',
  params: [],
  payloadInitError: true,
  [cause]: [error: type "serial" does not exist] {
    severity: 'ERROR',
    code: '42704',
    file: 'parse_type.c',
    line: '270',
    routine: 'typenameType'
  }
}
Current Database Schema

The column already has the correct structure:

SELECT column_name, data_type, column_default 
FROM information_schema.columns 
WHERE table_name = '_products_v_rels';

-- Result:
id | integer | nextval('_products_v_rels_id_seq'::regclass)
Root Cause

serial is a pseudo-type in PostgreSQL, not an actual data type. It's shorthand for creating an integer column with an auto-increment sequence. The correct type for the column is integer, which is already set correctly in the database.

Payload's push mode is trying to ALTER the column to type serial, which is invalid SQL.

Expected Behavior

Push mode should:

  1. Recognize that serial is not a real PostgreSQL type
  2. Understand that integer with a sequence (nextval()) is the correct equivalent
  3. Skip this ALTER TABLE operation when the column is already configured correctly
Current Workaround

Disable push mode: push: false and use migrations instead - but this removes the entire value proposition of push mode for development.

Configuration
db: postgresAdapter({
  pool: {
    connectionString: process.env.DATABASE_URI,
    ssl: { rejectUnauthorized: false },
  },
  push: true, // This triggers the error
})

This is particularly frustrating when working with existing databases where we want the convenience of push mode during development.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.