Re: Should PG backend know how to represent metadata? - Mailing list pgsql-hackers

From Philip Warner
Subject Re: Should PG backend know how to represent metadata?
Date
Msg-id 3.0.5.32.20000717170645.01fc8b80@mail.rhyme.com.au
Whole thread Raw
In response to Re: Should PG backend know how to represent metadata?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Should PG backend know how to represent metadata?  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-hackers
At 02:43 17/07/00 -0400, Tom Lane wrote:
>That is a
>substantial advantage, but you only get it if you make sure the backend
>display capability is defined in a way that lets all these apps use it.
>That might take some careful thought.  For example, does the definition
>of a table include associated constraints and indexes?

You need to separate the API from what is displayed (eg. in psql). 

Suggestion:

I would envisage the API consisting of a custom dump routine for each
object type. In the case of the table dumper API, it would return a table
definition with no indexes or constraints and a list of related entities
consisting of (object-type, object-oid) pairs suitable for passing back to
the dumper API. psql could display as little or as much as it  desired,
pg_dump could ferret the extra items away for later use etc. For those
items that can not be separated out, then they obviously have to go into
the main definition.


>Also, psql's \d command
>doesn't display the schema of a table in the form of a CREATE command
>to recreate it, and I don't think it should.  

I agree. \D is not to replace \d or \df etc.


>Certainly you don't want
>to condemn every app that wants to know "what are the columns of this
>table"

This is where we need to decide what the dumper code is for. I don't know
much about the other things you have mentioned, so perhaps you could
expand. But, in my original plan, this suggestion was intended for human
readable dumps from pg_dump and psql. It would be great if it could be made
to work elsewhere.

> to have to include a full SQL parser to make sense of the
>answer.   So I think some thought is needed to figure out what a
>general-purpose representation would be like.

And where it would go...





----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.C.N. 008 659 498)             |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: Should PG backend know how to represent metadata?
Next
From: Philip Warner
Date:
Subject: Re: Should PG backend know how to represent metadata?