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.20000718023038.0243b430@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>)
List pgsql-hackers
At 10:46 17/07/00 -0400, Tom Lane wrote:
>Philip Warner <pjw@rhyme.com.au> writes:
>> I don't think we have functions that return multiple rows,
>
>We do, although they're a bit unwieldy to use; might be better to avoid
>that feature.  I'd be inclined to avoid the issue, and just have the
>function return one result (which might contain newlines for readability
>of course).

Not sure that this has the flexibility needed for tables; I'd like the
calling application to be able to get just the base table definition with
no constraints, and also request the related items (constraints, indexes
etc). I also want to avoid the caller from having to parse the output in
any way.

Perhaps it is best left as an API-only feature, but now I have thought of
an SQL interface, I do like the idea.


>
>> Which brings me to my next idea:
>
>>     select defn from pg_dump where type='table and name = 'foo'
>> or
>>     select related_items from pg_dump where type='table and name = 'foo'
>
>> where pg_dump can be implemented via a rewrite rule....maybe.
>
>The rewrite rule couldn't do any of the heavy lifting; it'd still end
>up calling a function.  A view like pg_rules might not be a bad idea,
>but you should plan on exposing the underlying function for
>flexibility.

Sounds fine. Only I'm not sure that a rule can do it - AFAICT I still need
some underlying table to select from when I use a rule...unless I can fake
a result set for a 'special' table?


----------------------------------------------------------------
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: Larry Rosenman
Date:
Subject: Update: mac.c update, patch now on ftp
Next
From: Philip Warner
Date:
Subject: Re: Should PG backend know how to represent metadata?