Thread: Incorrect domain logic for 9.1

Incorrect domain logic for 9.1

From
Thom Brown
Date:
Hi,

I noticed that if I create a domain based on an array data type, it
doesn't get listed in the Domains node if the server is 9.1.  This is
because the query that gets the domains says that if the number of
dimensions used is greater than 0 (which it will be if it's an array),
then it must match against the OID shown in typelem.  As of 9.1 that's
no longer the case as typelem isn't used for domains anymore, although
I don't see why this was ever used by PgAdmin to get a list of domains
as it copes fine without this logic since typbasetype always provides
the necessary info.  Is the constituent base type of the array type
relevant anywhere in the domains section of PgAdmin?  I can't find any
place it actually uses it.

The attached patch removes the join logic completely to make it a
straightforward join.  From what I can tell (testing it against 8.4),
everything continues to work as usual, and now allows array-based
domains to be visible for 9.1 instances.

Could someone take a look, and see if there are cases this might
break?  In any case, a fix is needed.

--
Thom

Attachment

Re: Incorrect domain logic for 9.1

From
Dave Page
Date:
Hi

I know Guillaume is working on domain support at the moment, so I'm
going to leave it to him to incorporate this change, if he hasn't
already fixed it.

Guillaume; let me know if you want me to treat it independently and
review/commit regardless.

Thanks.

On Sat, Apr 21, 2012 at 10:21 PM, Thom Brown <thom@linux.com> wrote:
> Hi,
>
> I noticed that if I create a domain based on an array data type, it
> doesn't get listed in the Domains node if the server is 9.1.  This is
> because the query that gets the domains says that if the number of
> dimensions used is greater than 0 (which it will be if it's an array),
> then it must match against the OID shown in typelem.  As of 9.1 that's
> no longer the case as typelem isn't used for domains anymore, although
> I don't see why this was ever used by PgAdmin to get a list of domains
> as it copes fine without this logic since typbasetype always provides
> the necessary info.  Is the constituent base type of the array type
> relevant anywhere in the domains section of PgAdmin?  I can't find any
> place it actually uses it.
>
> The attached patch removes the join logic completely to make it a
> straightforward join.  From what I can tell (testing it against 8.4),
> everything continues to work as usual, and now allows array-based
> domains to be visible for 9.1 instances.
>
> Could someone take a look, and see if there are cases this might
> break?  In any case, a fix is needed.
>
> --
> Thom
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Incorrect domain logic for 9.1

From
Guillaume Lelarge
Date:
On Mon, 2012-04-23 at 09:14 +0100, Dave Page wrote:
> Hi
>
> I know Guillaume is working on domain support at the moment, so I'm
> going to leave it to him to incorporate this change, if he hasn't
> already fixed it.
>

I haven't fix it. I didn't even try to create a domain on a array.

> Guillaume; let me know if you want me to treat it independently and
> review/commit regardless.
>

Yes, please. If you can take care of it, it would be great.

I still need to fix an issue with the domain patch. If you have any idea
about this contextual menu issue, that would be great.


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com


Re: Incorrect domain logic for 9.1

From
Dave Page
Date:
On Mon, Apr 23, 2012 at 9:36 PM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
> On Mon, 2012-04-23 at 09:14 +0100, Dave Page wrote:
>> Hi
>>
>> I know Guillaume is working on domain support at the moment, so I'm
>> going to leave it to him to incorporate this change, if he hasn't
>> already fixed it.
>>
>
> I haven't fix it. I didn't even try to create a domain on a array.
>
>> Guillaume; let me know if you want me to treat it independently and
>> review/commit regardless.
>>
>
> Yes, please. If you can take care of it, it would be great.

Done - thanks Thom.

> I still need to fix an issue with the domain patch. If you have any idea
> about this contextual menu issue, that would be great.

They're always a pain in the backside to resolve. The usual issue is
that you've derived the action class from the wrong factory - usually
it needs to be contextActionFactory iirc.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Incorrect domain logic for 9.1

From
Thom Brown
Date:
On 24 April 2012 16:53, Dave Page <dpage@pgadmin.org> wrote:
> Done - thanks Thom.

Cheers Dave.

--
Thom