I want something like this:
CASE WHEN EXISTS(SELECT constraint_name FROM information_schema.table_constraints WHERE constraint_name = 'FK_ProductPurchased_Customer') THEN
ALTER TABLE "ProductPurchased" DROP CONSTRAINT "FK_ProductPurchased_Customer"
END;
But that's not valid SQL.
Do you know a way to do that with valid PostgreSQL SQL?
Our community of experts have been thoroughly vetted for their expertise and industry experience.