From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: nbipin29@gmail.com
Subject: BUG #17247: How to avoid crating multiple Foreign keys on same column on same table.
Date: Mon, 25 Oct 2021 23:29:23 +0000
Message-ID: <17247-dcd5bfeb3d7ecef5@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17247
Logged by: bipsy Nair
Email address: nbipin29@gmail.com
PostgreSQL version: 13.4
Operating system: Any OS
Description:
Issue: Postgres engine allows multiple FK on same columns for a same
table.This cause duplication and unwanted use of space . If we accidentally
run a script multiple times it creates the FK mulitple times.
Ran the following statement 3 times : to add a foreign key
ALTER TABLE admin.emp
ADD FOREIGN KEY (deptno)
REFERENCES admin.dept (deptno)
ON DELETE NO ACTION;
I see 3 its created thrice . In Oracle this statement should fail. Is there
any way this restriction can be applied on PG.
admin emp_deptno_fkey emp deptno admin dept deptno
admin emp_deptno_fkey1 emp deptno admin dept deptno
admin emp_deptno_fkey2 emp deptno admin dept deptno
Please advice.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, nbipin29@gmail.com
Subject: Re: BUG #17247: How to avoid crating multiple Foreign keys on same column on same table.
In-Reply-To: <17247-dcd5bfeb3d7ecef5@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox