Unix Technical Forum

Re: Current enums patch

This is a discussion on Re: Current enums patch within the Pgsql Patches forums, part of the PostgreSQL category; --> Am Dienstag, 27. März 2007 03:36 schrieb Tom Dunstan: > Here's the current version of the enums patch. Not ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 10:48 AM
Peter Eisentraut
 
Posts: n/a
Default Re: Current enums patch

Am Dienstag, 27. März 2007 03:36 schrieb Tom Dunstan:
> Here's the current version of the enums patch. Not much change from last
> time, the only thought-inducing stuff was fixing up some macros that
> changed with the VARLENA changes, and adding a regression test to do
> basic checking of RI behavior, after the discussions that we had
> recently on the ri_trigger stuff with generic types. The actual behavior
> was fixed by Tom's earlier patch, so this is just a sanity check.


Your patch doesn't compile anymore.

ccache cc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g -I. -I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o parse_coerce.o parse_coerce.c -MMD -MP -MF .deps/parse_coerce.Po
parse_coerce.c: In function 'can_coerce_type':
parse_coerce.c:460: error: too few arguments to function 'find_coercion_pathway'
parse_coerce.c: In function 'find_coercion_pathway':
parse_coerce.c:1817: error: too few arguments to function 'find_coercion_pathway'
parse_coerce.c:1822: error: too few arguments to function 'find_coercion_pathway'

This was only changed a few days ago, so you need to update your patch.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 10:49 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Current enums patch

Peter Eisentraut wrote:
> Am Dienstag, 27. März 2007 03:36 schrieb Tom Dunstan:
>
>> Here's the current version of the enums patch. Not much change from last
>> time, the only thought-inducing stuff was fixing up some macros that
>> changed with the VARLENA changes, and adding a regression test to do
>> basic checking of RI behavior, after the discussions that we had
>> recently on the ri_trigger stuff with generic types. The actual behavior
>> was fixed by Tom's earlier patch, so this is just a sanity check.
>>

>
> Your patch doesn't compile anymore.
>
> ccache cc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g -I. -I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o parse_coerce.o parse_coerce.c -MMD -MP -MF .deps/parse_coerce.Po
> parse_coerce.c: In function 'can_coerce_type':
> parse_coerce.c:460: error: too few arguments to function 'find_coercion_pathway'
> parse_coerce.c: In function 'find_coercion_pathway':
> parse_coerce.c:1817: error: too few arguments to function 'find_coercion_pathway'
> parse_coerce.c:1822: error: too few arguments to function 'find_coercion_pathway'
>
> This was only changed a few days ago, so you need to update your patch.
>
>


Peter,

If you want to review or test the feature, the attached patch can be
used as a replacement for the portion that affects parse_coerce.c, and
with this it compiles and passes regression. I think it's correct but it
should still be OKed by at least one Tom. :-)

cheers

andrew


---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 10:49 AM
Tom Lane
 
Posts: n/a
Default Re: Current enums patch

Andrew Dunstan <andrew@dunslane.net> writes:
> If you want to review or test the feature, the attached patch can be
> used as a replacement for the portion that affects parse_coerce.c, and
> with this it compiles and passes regression. I think it's correct but it
> should still be OKed by at least one Tom. :-)


Since Neil seems to have dropped the ball on this, I'm going to pick it
up and review/apply it. I need a break from thinking about HOT and
other bizarre schemes ;-)

Barring objection from Tom D, I'll start with this version.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 10:49 AM
Tom Lane
 
Posts: n/a
Default Re: Current enums patch

>>> Here's the current version of the enums patch.

[ sounds of reviewing... ] Is there a specific reason for
pg_enum.enumname to be type name and not type text? ISTM that type name
wastes space (because most labels will probably be a lot shorter than 63
bytes) and at the same time imposes an implementation restriction that
we don't need to have. It would make sense if the enum labels were
treated syntactically as SQL identifiers, but they're treated as
strings. And there's no particular win to be had by having a
fixed-length struct, since there's no more fields anyway.

Unless someone objects, I'll change this and also revert to the
enumlabel name that seems to have been used originally (it was still
used in the docs). It seems more readable somehow (I guess it's the
lack of either ascenders or descenders in "enumname").

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-18-2008, 10:49 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Current enums patch

Tom Lane wrote:
>>>> Here's the current version of the enums patch.
>>>>

>
> [ sounds of reviewing... ]


(What are those? It's a bit hard to imagine you singing "doo di doo doo"
a la Homer while reviewing ....)

> Is there a specific reason for
> pg_enum.enumname to be type name and not type text? ISTM that type name
> wastes space (because most labels will probably be a lot shorter than 63
> bytes) and at the same time imposes an implementation restriction that
> we don't need to have. It would make sense if the enum labels were
> treated syntactically as SQL identifiers, but they're treated as
> strings. And there's no particular win to be had by having a
> fixed-length struct, since there's no more fields anyway.
>


IIRC at one stage Tom wanted to try to make these identifiers, but that
was quickly abandoned. This might be a hangover from that. If someone
wants to use an insanely long enum label I guess that's their lookout.



cheers

andrew

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-18-2008, 10:49 AM
Tom Lane
 
Posts: n/a
Default Re: Current enums patch

Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> Is there a specific reason for
>> pg_enum.enumname to be type name and not type text?


> IIRC at one stage Tom wanted to try to make these identifiers, but that
> was quickly abandoned. This might be a hangover from that.


Actually I think I see the reason: it's a bit of a pain in the neck to
use the syscache mechanism with text-type lookup keys. I'm not 100%
convinced that we really need to have syscaches on pg_enum, but if those
stay then it's probably not worth the trouble to avoid the limitation.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-18-2008, 10:49 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Current enums patch

Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>
>> Tom Lane wrote:
>>
>>> Is there a specific reason for
>>> pg_enum.enumname to be type name and not type text?
>>>

>
>
>> IIRC at one stage Tom wanted to try to make these identifiers, but that
>> was quickly abandoned. This might be a hangover from that.
>>

>
> Actually I think I see the reason: it's a bit of a pain in the neck to
> use the syscache mechanism with text-type lookup keys. I'm not 100%
> convinced that we really need to have syscaches on pg_enum, but if those
> stay then it's probably not worth the trouble to avoid the limitation.
>
>
>


That rings a faint bell.

If we don't have syscaches on pg_enum won't enum i/o get more expensive?

cheers

andrew


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-18-2008, 10:49 AM
Tom Dunstan
 
Posts: n/a
Default Re: Current enums patch

Hi all! Thanks for reviewing the patch!

Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> Tom Lane wrote:
>>> Is there a specific reason for
>>> pg_enum.enumname to be type name and not type text?

>
>> IIRC at one stage Tom wanted to try to make these identifiers, but that
>> was quickly abandoned. This might be a hangover from that.

>
> Actually I think I see the reason: it's a bit of a pain in the neck to
> use the syscache mechanism with text-type lookup keys. I'm not 100%
> convinced that we really need to have syscaches on pg_enum, but if those
> stay then it's probably not worth the trouble to avoid the limitation.


Yeah, that was the reason IIRC. The syscaches are used by the I/O
functions: The one keyed on the pg_enum OID is for output, and the one
keyed on the type OID and label, err, name, are for input. As suggested
by a certain party here [1]. There didn't seem to be any text-like key
types to use in the syscache except the name type, and I didn't see the
63 byte limit being a big deal, that's way bigger than any sane enum
name that I've ever seen.

If we ditched the second syscache, we'd want some other way to convert a
type OID and name into the enum value oid efficiently. I originally
suggested having a cache that got hooked onto an fn_extra field; that
idea could be resurrected if you don't like the syscache.

Cheers

Tom


1[] http://archives.postgresql.org/pgsql...8/msg01022.php

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-18-2008, 10:49 AM
Tom Dunstan
 
Posts: n/a
Default Re: Current enums patch

Tom Lane wrote:
> Unless someone objects, I'll change this and also revert to the
> enumlabel name that seems to have been used originally (it was still
> used in the docs). It seems more readable somehow (I guess it's the
> lack of either ascenders or descenders in "enumname").


The name/text thing is discussed downthread. I actually started out
calling the field the name and changed it to the label, but perhaps I
only did that in the docs. It was probably while I was writing the docs
that I realized that name could refer to the enum type name or the value
name, which was confusing, but "value name" was kinda cumbersome, hence
"label". Change it over with my blessing.

Cheers

Tom

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-18-2008, 10:49 AM
Tom Lane
 
Posts: n/a
Default Re: Current enums patch

Tom Dunstan <pgsql@tomd.cc> writes:
> If we ditched the second syscache, we'd want some other way to convert a
> type OID and name into the enum value oid efficiently.


True. OK, never mind that then. I'll still rename it as per your
other comment.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:07 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com