Skip to content

reserved keyword double quote inconsistency #286

@tomi-rtk

Description

@tomi-rtk

When generating a plan into a .sql (or .json) file pgschema will correctly quote reserved keywords when executing ALTER TABLE statements but not when generating indexes. I know it is very unwise to name your tables with the same reserved keyword identifier but it's a legacy database and I cannot rename tables at this moment.,

Example:

ALTER TABLE "order"
ADD COLUMN tenant_id uuid CONSTRAINT "FK_order_tenant" REFERENCES tenant (id);

CREATE INDEX CONCURRENTLY IF NOT EXISTS "IDX_order_tenant_order_number" ON order (tenant_id, order_number);

My current strategy is executing this in my github workflow file, just after the plan generation.

sed -i 's/ON order /ON "order" /g' plan.sql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions