pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Barnard <tbarnard@povn.com>
To: pgsql-sql@postgresql.org
Subject: Re: Uniqueness of rule, constraint, and trigger names
Date: Mon, 4 Mar 2002 12:41:42 -0800
Message-ID: <015d01c1c3bc$fe622f40$a519af3f@hartcomm.com> (raw)
References: <7131.1015269848@sss.pgh.pa.us>

I agree with your statement: "I think that all three object types should
have names that are unique
among the objects associated with a particular table, but not unique across
a whole database."

To address the potential problem of "loading schemas of existing databases,"
why not let the new proposed behavior be the default behavior and provide a
configuration option and/or command line option that would enable the old
behavior - at least for some period of time.

Tim

----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: <pgsql-hackers@postgreSQL.org>; <pgsql-sql@postgreSQL.org>
Sent: Monday, March 04, 2002 11:24 AM
Subject: [SQL] Uniqueness of rule, constraint, and trigger names


> Currently we have a rather confusing mismash of behaviors for the names
> of rules, constraints, and triggers.  I'd like to unify the rules
> so that these objects all have the same naming behavior; and the only
> behavior that makes sense to me now is that of triggers.
>
> The current behavior is:
>
> 1. Rules are required to have a name that is unique within the current
> database.  The rule can be named without reference to the table it is
> on.  Dropping a rule is done with "DROP RULE name".
>
> 2. Constraints are not required to have any unique name at all.
> Dropping constraints is done with "ALTER TABLE tablename DROP CONSTRAINT
> constraintname", which will drop all constraints on that table that
> match the given name.
>
> 3. Triggers are required to have names that are unique among the
> triggers on a given table.  Dropping a trigger is done with "DROP
> TRIGGER name ON table".
>
> The SQL spec is not a great deal of help on this, since it doesn't
> have rules or triggers at all.  For constraints, it requires
> database-wide uniqueness of constraint names --- a rule I doubt
> anyone is going to favor adopting for Postgres.
>
> I think that all three object types should have names that are unique
> among the objects associated with a particular table, but not unique
> across a whole database.  So, triggers are okay already, but rules
> and constraints need work.
>
> For rules, we'd need to change the syntax of DROP RULE to be "DROP RULE
> name ON table", much like DROP TRIGGER.  This seems unlikely to cause
> problems for existing applications, since I doubt rule-dropping is done
> much by application code.
>
> For constraints, we'd need to change the code to be more careful to
> generate unique names for unnamed constraints.  That doesn't seem
> difficult, but I'm a little worried about the possibility of errors
> in loading schemas from existing databases, where there might be
> non-unique constraint names.  Perhaps it'd be safer to maintain the
> current behavior (no uniqueness required for constraint names).
>
> Comments?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>




view thread (15+ messages)  latest in thread

Message-ID: <015d01c1c3bc$fe622f40$a519af3f@hartcomm.com>
Permalink:  ../015d01c1c3bc$fe622f40$a519af3f@hartcomm.com/
Also on:    postgresql.org/message-id/015d01c1c3bc$fe622f40$a519af3f@hartcomm.com

 · 

reply

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-sql@postgresql.org
  Cc: tbarnard@povn.com
  Subject: Re: Uniqueness of rule, constraint, and trigger names
  In-Reply-To: <015d01c1c3bc$fe622f40$a519af3f@hartcomm.com>

* 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