Re: WIN1252 patch broke my database

Lists: pgsql-hackers
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: WIN1252 patch broke my database
Date: 2005-03-16 21:57:15
Message-ID: 10084.1111010235@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

You can't just randomly rearrange the pg_enc enum without forcing an
initdb, because the numeric values of the encodings appear in system
catalogs (eg pg_conversion).

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-16 22:58:56
Message-ID: 200503162258.j2GMwuh24264@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> You can't just randomly rearrange the pg_enc enum without forcing an
> initdb, because the numeric values of the encodings appear in system
> catalogs (eg pg_conversion).

Oh, those numbers appear in the catalogs? I didn't relealize that.

I will force an initdb.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: "Mark Woodward" <pgsql(at)mohawksoft(dot)com>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-16 23:27:33
Message-ID: 16779.24.91.171.78.1111015653.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> Tom Lane wrote:
>> You can't just randomly rearrange the pg_enc enum without forcing an
>> initdb, because the numeric values of the encodings appear in system
>> catalogs (eg pg_conversion).
>
> Oh, those numbers appear in the catalogs? I didn't relealize that.
>
> I will force an initdb.
>
Doesn't that also force the end-user to initdb with an upgrade?


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Mark Woodward <pgsql(at)mohawksoft(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-16 23:47:42
Message-ID: 200503162347.j2GNlga05687@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Mark Woodward wrote:
> > Tom Lane wrote:
> >> You can't just randomly rearrange the pg_enc enum without forcing an
> >> initdb, because the numeric values of the encodings appear in system
> >> catalogs (eg pg_conversion).
> >
> > Oh, those numbers appear in the catalogs? I didn't relealize that.
> >
> > I will force an initdb.
> >
> Doesn't that also force the end-user to initdb with an upgrade?

Yes, 8.1 will require a dump/reload for upgrade. I think we decided
that was going to be necessary.

That has aleady happened for 8.1:

date: 2005/02/28 03:45:21; author: neilc; state: Exp; lines: +2 -2
Implement max() and min() aggregates for array types. Patch from Koju
Iijima, reviewed by Neil Conway. Catalog version number bumped,
regression tests updated.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Neil Conway <neilc(at)samurai(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Mark Woodward <pgsql(at)mohawksoft(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-17 00:11:38
Message-ID: 4238CB3A.3030101@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Yes, 8.1 will require a dump/reload for upgrade. I think we decided
> that was going to be necessary.
>
> That has aleady happened for 8.1:
>
> date: 2005/02/28 03:45:21; author: neilc; state: Exp; lines: +2 -2
> Implement max() and min() aggregates for array types. Patch from Koju
> Iijima, reviewed by Neil Conway. Catalog version number bumped,
> regression tests updated.

Yes, as well as 4 other patches that have bumped the catversion number.
I think we are well past the point at which an 8.1 without an initdb
would be a plausible option (barring the materialization of a working
pg_upgrade tool, of course).

-Neil


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-17 18:04:23
Message-ID: 200503171904.23618.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Tom Lane wrote:
> > You can't just randomly rearrange the pg_enc enum without forcing
> > an initdb, because the numeric values of the encodings appear in
> > system catalogs (eg pg_conversion).
>
> Oh, those numbers appear in the catalogs? I didn't relealize that.
>
> I will force an initdb.

You shouldn't insert encodings in the middle, because those numbers are
exposed to clients. We've had troubles with that before. If you add
an encoding, append it as the last one (before the client encodings in
this case). This would probably also eliminate the need for the
initdb.

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-17 18:23:05
Message-ID: 25920.1111083785@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> You shouldn't insert encodings in the middle, because those numbers are
> exposed to clients. We've had troubles with that before. If you add
> an encoding, append it as the last one (before the client encodings in
> this case). This would probably also eliminate the need for the
> initdb.

It doesn't eliminate the need for initdb, because pg_conversion contains
instances of the client-only encoding numbers. I think that clients
know the client-only encoding numbers too, so I'm not sure we aren't
stuck with a compatibility issue.

Perhaps, as long as we are forced to renumber, we should reassign the
client-only encodings to higher numbers (starting at 100, perhaps)
so that there will be daylight to avoid this issue in the future.
This would cost some wasted space in the tables, I think, but that
could be worked around if it's large enough to be annoying.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-17 20:11:50
Message-ID: 200503172011.j2HKBoR28275@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > You shouldn't insert encodings in the middle, because those numbers are
> > exposed to clients. We've had troubles with that before. If you add
> > an encoding, append it as the last one (before the client encodings in
> > this case). This would probably also eliminate the need for the
> > initdb.
>
> It doesn't eliminate the need for initdb, because pg_conversion contains
> instances of the client-only encoding numbers. I think that clients
> know the client-only encoding numbers too, so I'm not sure we aren't
> stuck with a compatibility issue.
>
> Perhaps, as long as we are forced to renumber, we should reassign the
> client-only encodings to higher numbers (starting at 100, perhaps)
> so that there will be daylight to avoid this issue in the future.
> This would cost some wasted space in the tables, I think, but that
> could be worked around if it's large enough to be annoying.

What should I do with the CVS code now? Why is adding a gap between
client/server and client-only encodings in pg_wchar.h going to waste
space?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-17 20:15:58
Message-ID: 26970.1111090558@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> What should I do with the CVS code now? Why is adding a gap between
> client/server and client-only encodings in pg_wchar.h going to waste
> space?

IIRC there are some tables that are indexed directly by the encoding
number, so leaving holes in the code assignments requires empty slots in
the tables (or breaking the tables into two parts, which might be easier
to maintain anyway).

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-18 16:07:13
Message-ID: 200503181707.14566.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Am Donnerstag, 17. März 2005 19:23 schrieb Tom Lane:
> It doesn't eliminate the need for initdb, because pg_conversion contains
> instances of the client-only encoding numbers. I think that clients
> know the client-only encoding numbers too, so I'm not sure we aren't
> stuck with a compatibility issue.

I think the problem case was old pg_dump versions saving the encoding number
rather than name. I don't recall any problems with renumbering the client
encodings. I believe that we in fact did that in 8.0.

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIN1252 patch broke my database
Date: 2005-03-18 16:21:13
Message-ID: 8352.1111162873@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Am Donnerstag, 17. Mrz 2005 19:23 schrieb Tom Lane:
>> It doesn't eliminate the need for initdb, because pg_conversion contains
>> instances of the client-only encoding numbers. I think that clients
>> know the client-only encoding numbers too, so I'm not sure we aren't
>> stuck with a compatibility issue.

> I think the problem case was old pg_dump versions saving the encoding number
> rather than name. I don't recall any problems with renumbering the client
> encodings. I believe that we in fact did that in 8.0.

As long as client code only uses the names, I suppose we are OK. I'm a
bit worried about that assumption though, since it's not like the
numbers aren't exposed to view in pg_database and pg_conversion ...

regards, tom lane