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

From: Rod Taylor <rbt(at)zort(dot)ca>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: psql: show which tables contraints are for with a \d
Date: 2002-08-15 21:34:55
Message-ID: 1029447296.18448.127.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

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
>

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-08-16 00:56:24 Re: Antw: Re: File for /src/backend/port/netware
Previous Message Greg Sabino Mullane 2002-08-15 20:53:59 psql: show which tables contraints are for with a \d