Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

Invalid Postgresql drop foreign key

TheColorRed's profile image TheColorRed posted 1 month ago in General Permalink

When dropping a key in the "Foreign keys" tab, the command that is executed is this:

ALTER TABLE "example" DROP FOREIGN KEY "FK_key";

This throws an error:

ERROR: syntax error at or near "FOREIGN" LINE 2: DROP FOREIGN KEY "FK_key"

The proper syntax is (at least one that works) uses DROP CONSTRAINT instead of DROP FOREIGN KEY:

ALTER TABLE "example" DROP CONSTRAINT "FK_key";

PostgreSQL version:

$ SELECT VERSION()
PostgreSQL 12.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit
ansgar's profile image ansgar posted 1 month ago Permalink

That is quite helpful. Could you please report that in the Github tracker? See menu "Bugtracker" > "Bug reports"

Please login to leave a reply, or register at first.




Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.