meaningful trigger descriptions

From: "Jason S(dot) Friedman" <jason(at)powerpull(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: meaningful trigger descriptions
Date: 2003-02-17 21:06:47
Message-ID: 20030217210647.GA21589@charles
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

When one describes a table psql lists the foreign keys after the table columns, e.g.:

calendar=> \d business
Table "business"
Column | Type | Modifiers

------------------+-----------------------------+-----------------------------------------------
id | integer | not null default nextval('business_id'::text)
name | character varying(100) | not null
owner | character varying(100) | not null
address_line_1 | character varying(100) | not null
address_line_2 | character varying(100) |
city | character varying(100) | not null
state_code | character(2) | not null
zip | character(5) | not null
zip_4 | character(4) |
primary_timezone | character(3) | not null default 'GMT'
create_date | timestamp(0) with time zone | default now()
last_update_date | timestamp(0) with time zone |
create_by | integer |
last_update_by | integer |
Primary key: business_pk
Unique keys: business_name_key,
business_name_owner
Triggers: RI_ConstraintTrigger_56403390,
RI_ConstraintTrigger_56403392,
RI_ConstraintTrigger_56403426,
RI_ConstraintTrigger_56403428,
RI_ConstraintTrigger_56403514,
....

Does anyone have a query handy that will print out something prettier for those foreign key constraints, like:

tablename constraint
----------------------
foo FOREIGN KEY (a) REFERENCES bar
foo FOREIGN KEY (b) REFERENCES goo
bar q FOREIGN KEY (z) REFERENCES goo

Browse pgsql-novice by date

  From Date Subject
Next Message Dirk Hamstra 2003-02-17 22:17:14 Re Dynamic IP - pg_hba
Previous Message douggorley 2003-02-17 21:05:29 Re: MySQL comparable syntax for PostgreSQL