Re: Comments on SQL/Med objects

Lists: pgsql-hackers
From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Comments on SQL/Med objects
Date: 2011-03-22 22:23:19
Message-ID: 4D892157.7070607@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

While working on adding support for SQL/Med objects to pgAdmin, I'm
quite surprised to see there is no way to add comments to SQL/Med
objects. Is this on purpose or is it just something that was simply missed?

Thanks.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-03-23 16:03:32
Message-ID: AANLkTikUpkrTwTHbqeUn6-PTM7SH7Z_Pa5McdUqoeC-M@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Mar 22, 2011 at 6:23 PM, Guillaume Lelarge
<guillaume(at)lelarge(dot)info> wrote:
> While working on adding support for SQL/Med objects to pgAdmin, I'm
> quite surprised to see there is no way to add comments to SQL/Med
> objects. Is this on purpose or is it just something that was simply missed?

I think it's an oversight. We should probably fix this.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-03-23 16:53:46
Message-ID: 29529.1300899226@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Mar 22, 2011 at 6:23 PM, Guillaume Lelarge
> <guillaume(at)lelarge(dot)info> wrote:
>> While working on adding support for SQL/Med objects to pgAdmin, I'm
>> quite surprised to see there is no way to add comments to SQL/Med
>> objects. Is this on purpose or is it just something that was simply missed?

> I think it's an oversight. We should probably fix this.

Yeah, I had a private TODO about that. I'd like to see if we can
refactor the grammar to eliminate some of the duplication there
as well as the potential for oversights of this sort. I believe
that USER MAPPINGs are missing from ObjectType as well as a bunch
of other basic places ...

regards, tom lane


From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-03-23 17:13:32
Message-ID: 4D8A2A3C.7070709@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Le 23/03/2011 17:53, Tom Lane a écrit :
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Tue, Mar 22, 2011 at 6:23 PM, Guillaume Lelarge
>> <guillaume(at)lelarge(dot)info> wrote:
>>> While working on adding support for SQL/Med objects to pgAdmin, I'm
>>> quite surprised to see there is no way to add comments to SQL/Med
>>> objects. Is this on purpose or is it just something that was simply missed?
>
>> I think it's an oversight. We should probably fix this.
>
> Yeah, I had a private TODO about that. I'd like to see if we can
> refactor the grammar to eliminate some of the duplication there
> as well as the potential for oversights of this sort. I believe
> that USER MAPPINGs are missing from ObjectType as well as a bunch
> of other basic places ...
>

OK, great. Thanks for your answers.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-03-28 04:01:40
Message-ID: AANLkTimAUQ2wxZC8+J8YRAnTEcy9jspDBk16Z+8795vQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Mar 23, 2011 at 12:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Tue, Mar 22, 2011 at 6:23 PM, Guillaume Lelarge
>> <guillaume(at)lelarge(dot)info> wrote:
>>> While working on adding support for SQL/Med objects to pgAdmin, I'm
>>> quite surprised to see there is no way to add comments to SQL/Med
>>> objects. Is this on purpose or is it just something that was simply missed?
>
>> I think it's an oversight.  We should probably fix this.
>
> Yeah, I had a private TODO about that.  I'd like to see if we can
> refactor the grammar to eliminate some of the duplication there
> as well as the potential for oversights of this sort.  I believe
> that USER MAPPINGs are missing from ObjectType as well as a bunch
> of other basic places ...

Are you going to work on this? If not I can pick it up, at least
insofar as making the comment stuff work across the board.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-03-28 04:06:22
Message-ID: 18690.1301285182@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Mar 23, 2011 at 12:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Yeah, I had a private TODO about that. I'd like to see if we can
>> refactor the grammar to eliminate some of the duplication there
>> as well as the potential for oversights of this sort. I believe
>> that USER MAPPINGs are missing from ObjectType as well as a bunch
>> of other basic places ...

> Are you going to work on this? If not I can pick it up, at least
> insofar as making the comment stuff work across the board.

I'm still up to my rear in collations, so feel free.

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-03-28 04:29:06
Message-ID: AANLkTinxT4mDGRn0Jej_N3UGZYJ8V-qMupQcPa43ioJH@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Mar 28, 2011 at 12:06 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, Mar 23, 2011 at 12:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Yeah, I had a private TODO about that.  I'd like to see if we can
>>> refactor the grammar to eliminate some of the duplication there
>>> as well as the potential for oversights of this sort.  I believe
>>> that USER MAPPINGs are missing from ObjectType as well as a bunch
>>> of other basic places ...
>
>> Are you going to work on this?  If not I can pick it up, at least
>> insofar as making the comment stuff work across the board.
>
> I'm still up to my rear in collations, so feel free.

OK. I'll work on it this week.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-03-31 15:24:27
Message-ID: AANLkTimS1tDEuEeocz9PBjQ-RLSdjJ+VKFc_+F+Jm3Ou@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Mar 28, 2011 at 12:29 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, Mar 28, 2011 at 12:06 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>> On Wed, Mar 23, 2011 at 12:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>> Yeah, I had a private TODO about that.  I'd like to see if we can
>>>> refactor the grammar to eliminate some of the duplication there
>>>> as well as the potential for oversights of this sort.  I believe
>>>> that USER MAPPINGs are missing from ObjectType as well as a bunch
>>>> of other basic places ...
>>
>>> Are you going to work on this?  If not I can pick it up, at least
>>> insofar as making the comment stuff work across the board.
>>
>> I'm still up to my rear in collations, so feel free.
>
> OK.  I'll work on it this week.

Attached. Foreign tables are already OK, I believe; it's only foreign
data wrappers and foreign servers that appear to need fixing.

The fact that foreign data wrapper is sometimes abbreviated to fdw and
sometimes not does nothing for the greppability of the code. I'm
wondering if we should go through and fix the constants that
abbreviate it:

ACL_KIND_FDW
ACL_ALL_RIGHTS_FDW
OBJECT_FDW
OCLASS_FDW

It seems to me that it would be a whole lot clearer and easier if
these all spelled it out FOREIGN_DATA_WRAPPER, as we do for similar
object types. Other than a pretty minute back-patch hazard, I don't
see much down side. Thoughts?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
foreign-comment.patch application/octet-stream 11.3 KB

From: Shigeru HANADA <hanada(at)metrosystems(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-04-01 13:40:50
Message-ID: 20110401224049.7C20.6989961C@metrosystems.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, 31 Mar 2011 11:24:27 -0400
Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Attached. Foreign tables are already OK, I believe; it's only foreign
> data wrappers and foreign servers that appear to need fixing.

The patch seems good for basic functionarity. I've tested the patch
and noticed that get_foreign_data_wrapper_oid() is same as
GetForeignDataWrapperOidByName(), so they could be merged. Also
GetForeignServerOidByName() could be merged.

I changed "foreign data wrapper" in message to "foreign-data wrapper"
for consistency, but it's revertable.

Please see merge_oid_funcs.patch which can be applied onto your patch.

I think some supports can be added for comments on SQL/MED objects.

- pg_dump support for comment on fdw and server
- psql describe commands (\dew+ and \des+)
- psql TAB completion

Please see attached patches for each feature.

While testing pg_dump, I noticed that comment of extension's member
objects are not dumped by pg_dump. Those comments should be dumped
after CREATE EXTENSION statement?

Regards,
--
Shigeru Hanada

Attachment Content-Type Size
20110401_merge_oid_funcs.patch application/octet-stream 7.3 KB
20110401_pg_dump_support.patch application/octet-stream 886 bytes
20110401_psql_describe.patch application/octet-stream 42.1 KB
20110401_psql_tab.patch application/octet-stream 3.0 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Shigeru HANADA <hanada(at)metrosystems(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-04-01 15:30:08
Message-ID: AANLkTimgn_nRwgknooswZqVdXYHCCD59BrW77mN0dq0s@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Apr 1, 2011 at 9:40 AM, Shigeru HANADA
<hanada(at)metrosystems(dot)co(dot)jp> wrote:
> On Thu, 31 Mar 2011 11:24:27 -0400
> Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> Attached.  Foreign tables are already OK, I believe; it's only foreign
>> data wrappers and foreign servers that appear to need fixing.
>
> The patch seems good for basic functionarity.  I've tested the patch
> and noticed that get_foreign_data_wrapper_oid() is same as
> GetForeignDataWrapperOidByName(), so they could be merged.  Also
> GetForeignServerOidByName() could be merged.
>
> I changed "foreign data wrapper" in message to "foreign-data wrapper"
> for consistency, but it's revertable.
>
> Please see merge_oid_funcs.patch which can be applied onto your patch.

Thanks for the review, good catches. Committed those two patches
together with a bit of further rearrangement.

> I think some supports can be added for comments on SQL/MED objects.
>
>  - pg_dump support for comment on fdw and server
>  - psql describe commands (\dew+ and \des+)
>  - psql TAB completion
>
> Please see attached patches for each feature.

I'll take a look at these next.

> While testing pg_dump, I noticed that comment of extension's member
> objects are not dumped by pg_dump.  Those comments should be dumped
> after CREATE EXTENSION statement?

No, I don't believe that would be correct.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Shigeru HANADA <hanada(at)metrosystems(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comments on SQL/Med objects
Date: 2011-04-01 17:17:26
Message-ID: AANLkTikOmToiUCJJNg=7eGGG6fzoGaFD_TH5Ps=-2pM7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Apr 1, 2011 at 9:40 AM, Shigeru HANADA
<hanada(at)metrosystems(dot)co(dot)jp> wrote:
>  - pg_dump support for comment on fdw and server

Applied, good catch, thanks.

>  - psql describe commands (\dew+ and \des+)

Not sure if we want this behavior change or not. Any other opinions?
It doesn't look like there's any particular consistency in terms of
which backslash commands include a description always (e.g. \dT),
which ones include it only when + is specified (e.g. \dt), and which
don't include it at all (e.g. \dc).

>  - psql TAB completion

Committed this also.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company