Re: psql: show which tables contraints are for with a \d

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Rod Taylor <rbt(at)zort(dot)ca>
Cc: Greg Sabino Mullane <greg(at)turnstep(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: psql: show which tables contraints are for with a \d
Date: 2002-08-27 19:24:36
Message-ID: 200208271924.g7RJOau00771@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Rod, your patch is in CVS now, right?

---------------------------------------------------------------------------

Rod Taylor wrote:
> It should be noted that my patch in the queue displays the actual
> foreign key definition and suppresses 'Constraint' Triggers.
>
> This is a touch better than the below with the side effect that if a
> user issues a CREATE CONSTRAINT TRIGGER manually it is mistakenly
> hidden.
>
> Anyway, which one is applied is up to you guys.
>
>
>
> On Thu, 2002-08-15 at 16:53, Greg Sabino Mullane wrote:
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > NotDashEscaped: You need GnuPG to verify this message
> >
> >
> > This (inline) patch makes the display of trigggers a little less
> > hideous when you have many foreign keys, which causese the
> > creation of many RI_ConstraintTrigger_XXXXX triggers. If the
> > trigger is actually a constraint, it will show table the
> > constraint is for. Not much, but a little better than seeing
> > row after row of auto-generated trigger names.
> >
> >
> > Old way:
> >
> > greg=# \d alphabet
> > Table "public.alphabet"
> > Column | Type | Modifiers
> > --------+---------+-----------
> > aa | integer | not null
> > bb | integer |
> > cc | integer |
> > Indexes: alphabet_pkey primary key btree (aa),
> > alphabet_bb_key unique btree (bb),
> > alphabet_cc_key unique btree (cc)
> > Triggers: RI_ConstraintTrigger_16880,
> > RI_ConstraintTrigger_16881,
> > RI_ConstraintTrigger_16884,
> > RI_ConstraintTrigger_16885,
> > RI_ConstraintTrigger_16888,
> > my_little_trigger,
> > another_custom_trigger
> >
> > greg=# \d alphabet
> > Table "public.alphabet"
> > Column | Type | Modifiers
> > --------+---------+-----------
> > aa | integer | not null
> > bb | integer |
> > cc | integer |
> > Indexes: alphabet_pkey primary key btree (aa),
> > alphabet_bb_key unique btree (bb),
> > alphabet_cc_key unique btree (cc)
> > Triggers: RI_ConstraintTrigger_16880 (Constraint on public.foobar),
> > RI_ConstraintTrigger_16881 (Constraint on public.foobar),
> > RI_ConstraintTrigger_16884 (Constraint on public.mikey),
> > RI_ConstraintTrigger_16885 (Constraint on greg.watson),
> > RI_ConstraintTrigger_16888 (Constraint on greg.crick),
> > my_little_trigger,
> > another_custom_trigger
> >
> >
> >
> >
> > Index: describe.c
> > ===================================================================
> > RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/describe.c,v
> > retrieving revision 1.60
> > diff -r1.60 describe.c
> > 972c972,975
> > < "SELECT t.tgname\n"
> > ---
> > > "SELECT t.tgname || \n"
> > > " COALESCE((SELECT ' (' || '%s ' || n.nspname || '.' || c.relname || ')'\n"
> > > " FROM pg_class c, pg_namespace n\n"
> > > " WHERE c.relnamespace = n.oid AND c.oid = t.tgconstrrelid), '')\n"
> > 975c978
> > < oid);
> > ---
> > > _("Constraint on"), oid);
> >
> >
> >
> >
> > Greg Sabino Mullane greg(at)turnstep(dot)com
> > PGP Key: 0x14964AC8 200208151547
> > -----BEGIN PGP SIGNATURE-----
> > Comment: For info see http://www.gnupg.org
> >
> > iD8DBQE9XBZKvJuQZxSWSsgRAvVEAKCkZ+XXSsdRa0c4aAtThFo9A5So8gCg8ONH
> > WFL0VcOxndDiRcIUezggao8=
> > =U/NJ
> > -----END PGP SIGNATURE-----
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Rod Taylor 2002-08-27 19:28:23 Re: psql: show which tables contraints are for with a \d
Previous Message Rod Taylor 2002-08-27 18:56:52 Re: create or replace rule/view (fwd)