Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.

Lists: pgsql-committerspgsql-hackers
From: mha(at)postgresql(dot)org (Magnus Hagander)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-01-22 10:09:48
Message-ID: 20090122100948.89F977559ED@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Explicitly bind gettext to the correct encoding on Windows.

Original patch from Hiroshi Inoue.

Modified Files:
--------------
pgsql/src/backend/utils/mb:
mbutils.c (r1.77 -> r1.78)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/mbutils.c?r1=1.77&r2=1.78)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-01-22 23:27:47
Message-ID: 20643.1232666867@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

mha(at)postgresql(dot)org (Magnus Hagander) writes:
> Explicitly bind gettext to the correct encoding on Windows.

I have a couple of objections to this patch. First, what happens if
it fails to find a matching table entry? (The existing answer is
"nothing", but that doesn't seem right.) Second and more critical,
it adds still another data structure that has to be maintained when
the list of encodings changes, and it doesn't even live in the same
file as any existing encoding-information table.

What makes more sense to me is to add a table to encnames.c that
provides the gettext name of every encoding that we support.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-02-07 15:11:04
Message-ID: 200902071511.n17FB4t23514@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> mha(at)postgresql(dot)org (Magnus Hagander) writes:
> > Explicitly bind gettext to the correct encoding on Windows.
>
> I have a couple of objections to this patch. First, what happens if
> it fails to find a matching table entry? (The existing answer is
> "nothing", but that doesn't seem right.) Second and more critical,
> it adds still another data structure that has to be maintained when
> the list of encodings changes, and it doesn't even live in the same
> file as any existing encoding-information table.
>
> What makes more sense to me is to add a table to encnames.c that
> provides the gettext name of every encoding that we support.

Would someone please comment on Tom's questions above.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-02-15 14:08:51
Message-ID: 499821F3.7050004@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> mha(at)postgresql(dot)org (Magnus Hagander) writes:
>> Explicitly bind gettext to the correct encoding on Windows.
>
> I have a couple of objections to this patch. First, what happens if
> it fails to find a matching table entry? (The existing answer is
> "nothing", but that doesn't seem right.) Second and more critical,
> it adds still another data structure that has to be maintained when
> the list of encodings changes, and it doesn't even live in the same
> file as any existing encoding-information table.
>
> What makes more sense to me is to add a table to encnames.c that
> provides the gettext name of every encoding that we support.

Do you mean a separate table there, or should we add a new column to one
of the existing tables?

//Magnus


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-02-15 17:21:54
Message-ID: 22474.1234718514@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> Tom Lane wrote:
>> What makes more sense to me is to add a table to encnames.c that
>> provides the gettext name of every encoding that we support.

> Do you mean a separate table there, or should we add a new column to one
> of the existing tables?

Whichever seems to make more sense is fine with me. I just don't want
add-an-encoding maintenance requirements spread across N different
source files.

regards, tom lane


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-04-02 08:50:08
Message-ID: 49D47C40.5040300@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> Tom Lane wrote:
>>> What makes more sense to me is to add a table to encnames.c that
>>> provides the gettext name of every encoding that we support.
>
>> Do you mean a separate table there, or should we add a new column to one
>> of the existing tables?
>
> Whichever seems to make more sense is fine with me. I just don't want
> add-an-encoding maintenance requirements spread across N different
> source files.

I was about to start looking at this when that other thread
(http://archives.postgresql.org//pgsql-hackers/2009-03/msg01270.php)
started about related issues on other platforms. Seems we should have a
"coordinated fix" for this, so I'm going to want and see what come sout
of that one. Unless I'm misunderstanding thigns and they're not related?

//Magnus


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-04-08 10:36:01
Message-ID: 49DC7E11.2050501@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Magnus Hagander wrote:
> Tom Lane wrote:
>> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>>> Tom Lane wrote:
>>>> What makes more sense to me is to add a table to encnames.c that
>>>> provides the gettext name of every encoding that we support.
>>> Do you mean a separate table there, or should we add a new column to one
>>> of the existing tables?
>> Whichever seems to make more sense is fine with me. I just don't want
>> add-an-encoding maintenance requirements spread across N different
>> source files.
>
> I was about to start looking at this when that other thread
> (http://archives.postgresql.org//pgsql-hackers/2009-03/msg01270.php)
> started about related issues on other platforms. Seems we should have a
> "coordinated fix" for this, so I'm going to want and see what come sout
> of that one. Unless I'm misunderstanding thigns and they're not related?

I've committed a fairly trivial patch per Peter's suggestion to fix the
other thread's issue. I left the table as is, so whatever refactorings
were planned can now be applied.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-04-20 09:37:51
Message-ID: 49EC426F.5020602@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Heikki Linnakangas wrote:
> Magnus Hagander wrote:
>> Tom Lane wrote:
>>> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>>>> Tom Lane wrote:
>>>>> What makes more sense to me is to add a table to encnames.c that
>>>>> provides the gettext name of every encoding that we support.
>>>> Do you mean a separate table there, or should we add a new column to
>>>> one
>>>> of the existing tables?
>>> Whichever seems to make more sense is fine with me. I just don't want
>>> add-an-encoding maintenance requirements spread across N different
>>> source files.
>>
>> I was about to start looking at this when that other thread
>> (http://archives.postgresql.org//pgsql-hackers/2009-03/msg01270.php)
>> started about related issues on other platforms. Seems we should have a
>> "coordinated fix" for this, so I'm going to want and see what come sout
>> of that one. Unless I'm misunderstanding thigns and they're not related?
>
> I've committed a fairly trivial patch per Peter's suggestion to fix the
> other thread's issue. I left the table as is, so whatever refactorings
> were planned can now be applied.

Here's a patch that moves the table over to encnames.c, and renames it
to look like the others.

I don't know what it should be doing if it can't find a match, so I
haven't changed that behavior.

Comments?

//Magnus

Attachment Content-Type Size
enctable.patch text/x-diff 3.7 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-04-20 14:38:02
Message-ID: 5720.1240238282@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> Tom Lane wrote:
>>> What makes more sense to me is to add a table to encnames.c that
>>> provides the gettext name of every encoding that we support.

> Here's a patch that moves the table over to encnames.c, and renames it
> to look like the others.

I think you forgot to include the NULL terminating entry that the
loop seems to be expecting. Also, why isn't the array "const"?

> I don't know what it should be doing if it can't find a match, so I
> haven't changed that behavior.

As things stand, it should throw error, except in the case of SQL_ASCII;
there is no excuse for any other database encoding to not be in the
table. However, what seems more worrisome to me is the prospect already
discussed that the codeset name we have in the table is not actually
recognized by gettext/iconv. Did we have a solution for that?

Anyway, this fixes my immediate concern about where the info is located,
so you may as well apply it with the array-terminator fix.

regards, tom lane


From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-04-20 14:50:22
Message-ID: 49EC8BAE.1040901@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> However, what seems more worrisome to me is the prospect already
> discussed that the codeset name we have in the table is not actually
> recognized by gettext/iconv. Did we have a solution for that?

You get English.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [COMMITTERS] pgsql: Explicitly bind gettext to the correct encoding on Windows.
Date: 2009-04-24 08:44:15
Message-ID: 49F17BDF.2060104@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
>> I don't know what it should be doing if it can't find a match, so I
>> haven't changed that behavior.
>
> As things stand, it should throw error, except in the case of SQL_ASCII;
> there is no excuse for any other database encoding to not be in the
> table. However, what seems more worrisome to me is the prospect already
> discussed that the codeset name we have in the table is not actually
> recognized by gettext/iconv. Did we have a solution for that?
>
> Anyway, this fixes my immediate concern about where the info is located,
> so you may as well apply it with the array-terminator fix.

Done.

//Magnus