Skip to content

DROP INDEX fails after ALTER TABLE ... RENAME COLUMN ... with Column "<old_col>" not found #473

@bap2pecs

Description

@bap2pecs

Describe the bug

DROP INDEX fails in pg-mem after a column rename, even though the same SQL succeeds on PostgreSQL.

Specifically:

  1. Create an index on old_col
  2. Rename old_col to new_col
  3. Drop the old index by name

Step 3 fails:

DROP INDEX IF EXISTS demo_some_id_old_col_unique
Error: Column "old_col" not found

To Reproduce

CREATE TABLE demo (
  some_id text NOT NULL,
  old_col text NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS demo_some_id_old_col_unique
  ON demo USING btree (some_id, old_col);

ALTER TABLE demo RENAME COLUMN old_col TO new_col;

DROP INDEX IF EXISTS demo_some_id_old_col_unique;

This succeeds on a real PostgreSQL database, but fails in pg-mem.

pg-mem version

Installed version from local node_modules: "3.0.12"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions