psql feature request (\dd+)

From: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: psql feature request (\dd+)
Date: 2010-05-14 15:35:10
Message-ID: AANLkTimQJOAPAgofwNEsL8OasegwVcKIQKX_GUkW5nxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It'd be nice if there was a \dd+ command to return all of the comments
of dependent objects in addition to the specified object; i.e. all
dependent objects related to a table for example.

Notice the difference between difference between a well documented DDL
script versus the results returned by psql's \dd. The command \d+
shows a bit more but not everything.

/* ISATags is a set of tag numbers that are used to identify
process instrumentation. */

CREATE TABLE ISATags (
PRIMARY KEY( area_code, process_code, loop_nbr, tag_seq ),

/* area_code identifies the area or process unit that
a tagged instrument supports. Valid area_codes can
be numbered any value between 0 and 9999.
*/
area_code INTEGER DEFAULT 0 NOT NULL
CONSTRAINT valid_area_codes
CHECK( area_code BETWEEN 0 and 9999 ),

/* process_code is a coded defined by the ISA in
the normative reference XXXX-XXX. This code
defines the type by procces and the function
of the instrument defined by the ISAtag. A
process code is a 2 to 4 character sequence.
*/
process_code VARCHAR( 6 ) NOT NULL
CONSTRAINT valid_process_codes
CHECK( process_code ~ E'^[A-Z]{2,4}$' ),
/* all tags in an area with the same loop_nbr are
related and work together in support of a proccess
function. Loop numbers must be greater than 0,
however and arbitary upper limit of 9999 is
applied since some legacy control system cannot
support loop number greater than this value.
*/
loop_nbr INTEGER DEFAULT 0 NOT NULL
CONSTRAINT valid_loop_nbrs
CHECK( loop_nbr BETWEEN 0 AND 9999 ),

/* tag_seq is a sequence letter that distinguses
instruments of identical function that work together
in support of a proccess function. This field is
optional but must be an alphbetic character when
used.
*/
tag_seq VARCHAR( 2 ) DEFAULT '' NOT NULL
CONSTRAINT valid_tag_seqs
CHECK( tag_seq ~ E'^(?:[A-Z])?$' )
);

COMMENT ON TABLE ISATags
IS 'ISATags is a set of tag numbers that are used
to identify process instrumentation.';

COMMENT ON COLUMN ISATags.area_code
IS 'area_code identifies the area or process unit
that a tagged instrument supports.';

COMMENT ON CONSTRAINT valid_area_codes
ON ISATags
IS 'Valid area_codes can be numbered any value
between 0 and 9999.';

COMMENT ON COLUMN ISATags.process_code
IS 'process_code is a coded defined by the ISA in
the normative reference XXXX-XXX. This code defines the type by
procces and the function of the instrument defined by the ISAtag.';

COMMENT ON CONSTRAINT valid_process_codes
ON ISATags
IS 'A process code is a 2 to 4 character sequence.';

COMMENT ON COLUMN ISATags.loop_nbr
IS 'all tags in an area with the same loop_nbr are
related and work together in support of a proccess function. ';

COMMENT ON CONSTRAINT valid_loop_nbrs
ON ISATags
IS 'Loop numbers must be greater than 0, however
and arbitary upper limit of 9999 is applied since some legacy control
system cannot support loop number greater than this value.';

COMMENT ON COLUMN ISATags.tag_seq
IS 'tag_seq is a sequence letter that distinguses
instruments of identical function that work together in support of a
proccess function.';

COMMENT ON CONSTRAINT valid_tag_seqs
ON ISATags
IS 'This field is optional but must be an alphbetic
character when used.';

\dd ISAtags

Object descriptions
Schema | Name | Object | Description
--------+---------+--------+------------------------------------------------------------------------------------
public | isatags | table | ISATags is a set of tag numbers that are
used to identify process instrumentation.
(1 row)

\dd+ ISATags
Object descriptions
Schema | Name | Object | Description
--------+---------+--------+------------------------------------------------------------------------------------
public | isatags | table | ISATags is a set of tag numbers that are
used to identify process instrumentation.
(1 row)

\d+ isatags

Table
"public.isatags"
Column | Type | Modifiers
| Storage |
Descript
--------------+----------------------+----------------------------------------+----------+-------------------------------------------------------------------------------------------
area_code | integer | not null default 0
| plain | area_code identifies the area or process unit that
a tagged instrument supports.
process_code | character varying(6) | not null
| extended | process_code is a coded defined by the ISA in the
normative reference XXXX-XXX. This code
loop_nbr | integer | not null default 0
| plain | all tags in an area with the same loop_nbr are
related and work together in support of a p
tag_seq | character varying(2) | not null default ''::character
varying | extended | tag_seq is a sequence letter that distinguses
instruments of identical function that work
Indexes:
"isatags_pkey" PRIMARY KEY, btree (area_code, process_code,
loop_nbr, tag_seq)
Check constraints:
"valid_area_codes" CHECK (area_code >= 0 AND area_code <= 9999)
"valid_loop_nbrs" CHECK (loop_nbr >= 0 AND loop_nbr <= 9999)
"valid_process_codes" CHECK (process_code::text ~ '^[A-Z]{2,4}$'::text)
"valid_tag_seqs" CHECK (tag_seq::text ~ '^(?:[A-Z])?$'::text)
Has OIDs: no

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2010-05-14 15:37:34 Re: List traffic
Previous Message Tom Lane 2010-05-14 15:21:22 Re: List traffic