Unix Technical Forum

Why are default encoding conversions namespace-specific?

This is a discussion on Why are default encoding conversions namespace-specific? within the pgsql Hackers forums, part of the PostgreSQL category; --> See $SUBJECT. It seems to me this is a bad idea for much the same reasons that we recently ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 01:45 AM
Tom Lane
 
Posts: n/a
Default Why are default encoding conversions namespace-specific?

See $SUBJECT. It seems to me this is a bad idea for much the same
reasons that we recently decided default index operator classes should
not be namespace-specific:
http://archives.postgresql.org/pgsql...2/msg00284.php

I don't mind having encoding conversions be named within schemas,
but I propose that any given encoding pair be allowed to have only
one default conversion, period, and that when we are looking for
a default conversion we find it by a non-namespace-aware search.

With the existing definition, any change in search_path could
theoretically cause a change in client-to-server encoding conversion
behavior, and this just seems like a really bad idea. (It's only
theoretical because we don't actually redo the conversion function
search on a search_path change ... but if you think the existing
definition is good then that's a bug.)

Comments?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 01:45 AM
Tatsuo Ishii
 
Posts: n/a
Default Re: Why are default encoding conversions

> See $SUBJECT. It seems to me this is a bad idea for much the same
> reasons that we recently decided default index operator classes should
> not be namespace-specific:
> http://archives.postgresql.org/pgsql...2/msg00284.php
>
> I don't mind having encoding conversions be named within schemas,
> but I propose that any given encoding pair be allowed to have only
> one default conversion, period, and that when we are looking for
> a default conversion we find it by a non-namespace-aware search.


That doesn't sound good idea to me.

> With the existing definition, any change in search_path could
> theoretically cause a change in client-to-server encoding conversion
> behavior, and this just seems like a really bad idea. (It's only
> theoretical because we don't actually redo the conversion function
> search on a search_path change ... but if you think the existing
> definition is good then that's a bug.)


Then why do we have CREATE DEFAULT CONVERSION command at all?
--
Tatsuo Ishii
SRA OSS, Inc. Japan

---------------------------(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
  #3 (permalink)  
Old 04-12-2008, 01:45 AM
Tom Lane
 
Posts: n/a
Default Re: Why are default encoding conversions namespace-specific?

Tatsuo Ishii <ishii@sraoss.co.jp> writes:
>> I don't mind having encoding conversions be named within schemas,
>> but I propose that any given encoding pair be allowed to have only
>> one default conversion, period, and that when we are looking for
>> a default conversion we find it by a non-namespace-aware search.


> That doesn't sound good idea to me.


What does it mean to have different "default" encoding conversions in
different schemas? Even if this had a sensible interpretation, I don't
think the existing code implements it properly.

> Then why do we have CREATE DEFAULT CONVERSION command at all?


So you can create the one you're allowed to have, of course ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-12-2008, 01:45 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Why are default encoding conversions namespace-specific?

Tom Lane said:
> Tatsuo Ishii <ishii@sraoss.co.jp> writes:
>>> I don't mind having encoding conversions be named within schemas, but
>>> I propose that any given encoding pair be allowed to have only one
>>> default conversion, period, and that when we are looking for a
>>> default conversion we find it by a non-namespace-aware search.

>
>> That doesn't sound good idea to me.

>
> What does it mean to have different "default" encoding conversions in
> different schemas? Even if this had a sensible interpretation, I don't
> think the existing code implements it properly.


perhaps I'm misunderstanding, but why not just resolve the namespace at the
time the default conversion is created?

cheers

andrew






---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-12-2008, 01:45 AM
Tom Lane
 
Posts: n/a
Default Re: Why are default encoding conversions namespace-specific?

"Andrew Dunstan" <andrew@dunslane.net> writes:
> Tom Lane said:
>> What does it mean to have different "default" encoding conversions in
>> different schemas? Even if this had a sensible interpretation, I don't
>> think the existing code implements it properly.


> perhaps I'm misunderstanding, but why not just resolve the namespace at the
> time the default conversion is created?


Isn't that the same thing as saying that there can only be one default
conversion across all schemas? ("Only one" for a given source and
target encoding pair, of course.) If it isn't the same, please explain
more clearly.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-12-2008, 01:45 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Why are default encoding conversions namespace-specific?

Tom Lane said:
> "Andrew Dunstan" <andrew@dunslane.net> writes:
>> Tom Lane said:
>>> What does it mean to have different "default" encoding conversions in
>>> different schemas? Even if this had a sensible interpretation, I
>>> don't think the existing code implements it properly.

>
>> perhaps I'm misunderstanding, but why not just resolve the namespace
>> at the time the default conversion is created?

>
> Isn't that the same thing as saying that there can only be one default
> conversion across all schemas? ("Only one" for a given source and
> target encoding pair, of course.) If it isn't the same, please explain
> more clearly.
>
>


Yeah, I guess it is. I was thinking of it more as "namespace-specified" than
as "non-namespace-aware". I guess it's a matter of perspective.

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
  #7 (permalink)  
Old 04-12-2008, 01:46 AM
Tatsuo Ishii
 
Posts: n/a
Default Re: Why are default encoding conversions

> Tatsuo Ishii <ishii@sraoss.co.jp> writes:
> >> I don't mind having encoding conversions be named within schemas,
> >> but I propose that any given encoding pair be allowed to have only
> >> one default conversion, period, and that when we are looking for
> >> a default conversion we find it by a non-namespace-aware search.

>
> > That doesn't sound good idea to me.

>
> What does it mean to have different "default" encoding conversions in
> different schemas? Even if this had a sensible interpretation, I don't
> think the existing code implements it properly.
>
> > Then why do we have CREATE DEFAULT CONVERSION command at all?

>
> So you can create the one you're allowed to have, of course ...


If you do allow only one default conversion for encodings A and B
regardless schemas, then how one can have different default conversion
for A and B?

I'm sure we need more than one default conversion for encoding A and
B. For example, different vendors provide different conversion maps
for SJIS and UTF-8. M$ has its own and Apple has another one, etc. The
differences are not huge but some customers might think the difference
is critical. In this case they could create their own conversion in
their schema.
--
Tatsuo Ishii
SRA OSS, Inc. Japan

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-12-2008, 01:46 AM
Tom Lane
 
Posts: n/a
Default Re: Why are default encoding conversions

Tatsuo Ishii <ishii@sraoss.co.jp> writes:
> I'm sure we need more than one default conversion for encoding A and
> B. For example, different vendors provide different conversion maps
> for SJIS and UTF-8. M$ has its own and Apple has another one, etc. The
> differences are not huge but some customers might think the difference
> is critical. In this case they could create their own conversion in
> their schema.


Well, being able to switch to a different conversion is fine, but I don't
think that's a good argument for tying it to the schema search path.
What would make more sense to me is a command specifically setting the
conversion to use --- perhaps a GUC variable, since then ALTER USER SET
and ALTER DATABASE SET would provide convenient ways of controlling it.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-12-2008, 01:46 AM
Tatsuo Ishii
 
Posts: n/a
Default Re: Why are default encoding conversions

> Tatsuo Ishii <ishii@sraoss.co.jp> writes:
> > I'm sure we need more than one default conversion for encoding A and
> > B. For example, different vendors provide different conversion maps
> > for SJIS and UTF-8. M$ has its own and Apple has another one, etc. The
> > differences are not huge but some customers might think the difference
> > is critical. In this case they could create their own conversion in
> > their schema.

>
> Well, being able to switch to a different conversion is fine, but I don't
> think that's a good argument for tying it to the schema search path.
> What would make more sense to me is a command specifically setting the
> conversion to use --- perhaps a GUC variable, since then ALTER USER SET
> and ALTER DATABASE SET would provide convenient ways of controlling it.


If it does work, then it's ok. However still I'm not sure why current
method is evil.

BTW, what does the standard say about conversion vs. schema? Doesn't
conversion belong to schema? If so, then schema specific default
conversion seems more standard-friendly way.
--
Tatsuo Ishii
SRA OSS, Inc. Japan

---------------------------(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
  #10 (permalink)  
Old 04-12-2008, 01:46 AM
Tom Lane
 
Posts: n/a
Default Re: Why are default encoding conversions

Tatsuo Ishii <ishii@sraoss.co.jp> writes:
>> Well, being able to switch to a different conversion is fine, but I don't
>> think that's a good argument for tying it to the schema search path.


> If it does work, then it's ok. However still I'm not sure why current
> method is evil.


Because with the current definition, any change in search_path really
ought to lead to repeating the lookup for the default conversion proc.
That's a bad idea from a performance point of view and I don't think
it's a particularly good idea from the definitional point of view
either --- do you really want the client conversion changing because
some function altered the search path?

> BTW, what does the standard say about conversion vs. schema? Doesn't
> conversion belong to schema? If so, then schema specific default
> conversion seems more standard-friendly way.


AFAICT we invented the entire concept of conversions ourselves. I see
nothing about CREATE CONVERSION in the SQL spec. There is a CREATE
TRANSLATION in SQL2003, which we'd probably not seen when we invented
CREATE CONVERSION, but it does *not* have a DEFAULT clause. I don't
think you can point to the spec to defend our current method of
selecting which conversion to use.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

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 08:35 AM.


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