Re: Have \d show child tables that inherit from the specified parent

From: damien clochard <damien(at)dalibo(dot)info>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Have \d show child tables that inherit from the specified parent
Date: 2009-03-20 08:11:08
Message-ID: 49C34F9C.7090101@dalibo.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Sabino Mullane wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
>> This one is very basic, it just shows the child tables of a specific
>> table when you type \d <tablename> in psql :
>
> I'm not so jazzed about this, as I work on systems that have literally
> hundreds of child tables.

hi everyone.

Thanks for your comments.

I must admit that i didn't asked myself much questions when i
implemented that feature. As i said i picked that item almost randomly
in the todo list. I choosed to show child table on \d instead \d+ in
order to be consistant with the fact that \d shows the mother of the
specified table.

That being said i recognize that people who have dozens of child tables
might get annoyed by this patch.

Here's 3 ideas that could make things better :

1- When using \d , only show the numbers of child tables

2- Only display the list of child table when \d+ is used. (mode ???)

3- Display the child table names in line, instead of one line per table.

Here's what it would look like :

# \d mother
Table "public.mother"
Column | Type | Modifiers
--------+---------+-----------------------------------------------------
id | integer | not null default nextval('mother_id_seq'::regclass)
This table has 5 child tables. Use \d+ to display them.

#\d+ mother
Table "public.mother"
Column | Type | Modifiers
--------+---------+-----------------------------------------------------
id | integer | not null default nextval('mother_id_seq'::regclass)
Child tables : daughter1, daughter2, daughter3, daughter4, daughter5

Does it look better ?

--
damien clochard
dalibo.org | dalibo.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-03-20 08:31:27 Re: Extension of Thick Indexes
Previous Message Gokulakannan Somasundaram 2009-03-20 06:46:42 Re: Extension of Thick Indexes