Skip to content

CockroachDB: $identitySelect may fail with unique_rowid() #1971

@bpamiri

Description

@bpamiri

Summary

CockroachDBModel inherits PostgreSQL's $identitySelect() which calls pg_get_serial_sequence() and currval(). These may not work correctly with CockroachDB's unique_rowid() default values.

Details

  • PostgreSQL uses sequences behind SERIALcurrval() retrieves last inserted value
  • CockroachDB's unique_rowid() doesn't use sequences, so pg_get_serial_sequence() returns NULL
  • Need CockroachDB-specific identity retrieval, likely using RETURNING clause
  • CockroachDB supports INSERT INTO ... RETURNING id natively

Files

  • vendor/wheels/databaseAdapters/CockroachDB/CockroachDBModel.cfc — needs $identitySelect() override
  • vendor/wheels/databaseAdapters/PostgreSQL/PostgreSQLModel.cfc:124-171 — inherited method

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugphase:1-stabilizeBugs, cleanup, CI fixes — tackle first

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions