When you try to run SQL statements in PostgreSQL you get this error:
ERROR: duplicate connection name
********** Error **********
ERROR: duplicate connection name
SQL state: 42710
This may be because you have a dblink open. To fix this, close the existing connection. To close the connection, search for dblink_connect to get the name of the duplicate connection then use this command:
SELECT public.dblink_disconnect(‘Name of duplicate connection’);
❗ Note: You may need to roll back the transaction first using this command: rollback transaction;
Alternatively, you may be trying to create a new connection with the same name as a connection that’s stored in a different schema. Try renaming your connection and trying again.