Prevent Postgres from automatically lower casing constraint names

Reading Time: 1 minute

This doesn’t work:

ALTER TABLE company DROP CONSTRAINT UQ_924dc2ee53aa15f1b16b4af12be;

Postgres says that this constraint doesn’t exist.

Solution

The problem is that Postgres will lowercase the constraint name. Use double quotes around the constraint name, like this:

ALTER TABLE company DROP CONSTRAINT "UQ_924dc2ee53aa15f1b16b4af12be";

We transform challenges into digital experiences

Get in touch to let us know what you’re looking for. Our policy includes 14 days risk-free!

Free project consultation