-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels