Hi,

Martin Pitt [2007-10-12 16:33 +0200]:
> I'm currently hunting down the last postgresql-common test case
> failure that I see with 8.3beta1. It seems the 8.3 version of libpq
> changes some internal encoding lists?

Ah, got it. The ordering in pg_enc2name_tbl[] changed, which makes the
indices jump around. This was introduced in [1], in particular in
those two bits:

  
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/mb/pg_wchar.h.diff?r1=1.71;r2=1.72
  
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/encnames.c.diff?r1=1.32;r2=1.33

With attached patch (which restores the previous ordering)
compatibility with 8.2 is restored. This has two drawbacks:

 * The enum cannot be nicely sorted by internal and client-only
   encodings until libpq bumps soname again. This is only a cosmetical
   problem, though.

 * This patch needs another catalog bump (to "unbump" the
   one in [1]). That's unfortunate, but the catalog number got bumped
   in between beta and release in earlier versions, too, so I hope
   it's not too bad.

The pg_enc2name_tbl declaration should probably have a comment saying
to never alter the order, but only append new stuff at the end. For
encodings which became obsolete (should that happen) there should be
an constant like "INVALID" or "DEPRECATED".

Thank you!

Martin

[1] http://archives.postgresql.org/pgsql-committers/2007-04/msg00198.php


-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org
diff -Nur postgresql-8.3/build-tree/postgresql-8.3beta1/src/backend/utils/mb/encnames.c postgresql-8.3.new/build-tree/postgresql-8.3beta1/src/backend/utils/mb/encnames.c
--- postgresql-8.3beta1/src/backend/utils/mb/encnames.c	2007-04-16 20:50:49.000000000 +0200
+++ postgresql-8.3beta1/src/backend/utils/mb/encnames.c	2007-10-12 16:56:35.000000000 +0200
@@ -314,6 +314,9 @@
 		"EUC_TW", PG_EUC_TW
 	},
 	{
+		"JOHAB", PG_JOHAB
+	},
+	{
 		"UTF8", PG_UTF8
 	},
 	{
@@ -413,9 +416,6 @@
 		"UHC", PG_UHC
 	},
 	{
-		"JOHAB", PG_JOHAB
-	},
-	{
 		"GB18030", PG_GB18030
 	},
 	{
diff -Nur postgresql-8.3/build-tree/postgresql-8.3beta1/src/include/catalog/catversion.h postgresql-8.3.new/build-tree/postgresql-8.3beta1/src/include/catalog/catversion.h
--- postgresql-8.3beta1/src/include/catalog/catversion.h	2007-09-30 21:54:58.000000000 +0200
+++ postgresql-8.3beta1/src/include/catalog/catversion.h	2007-10-12 16:56:47.000000000 +0200
@@ -53,6 +53,6 @@
  */
 
 /*							yyyymmddN */
-#define CATALOG_VERSION_NO	200709301
+#define CATALOG_VERSION_NO	200710121
 
 #endif
diff -Nur postgresql-8.3/build-tree/postgresql-8.3beta1/src/include/mb/pg_wchar.h postgresql-8.3.new/build-tree/postgresql-8.3beta1/src/include/mb/pg_wchar.h
--- postgresql-8.3beta1/src/include/mb/pg_wchar.h	2007-09-18 19:41:17.000000000 +0200
+++ postgresql-8.3beta1/src/include/mb/pg_wchar.h	2007-10-12 16:56:35.000000000 +0200
@@ -158,6 +158,7 @@
 	PG_EUC_CN,					/* EUC for Chinese */
 	PG_EUC_KR,					/* EUC for Korean */
 	PG_EUC_TW,					/* EUC for Taiwan */
+	PG_JOHAB,					/* EUC for Korean JOHAB; client encoding only, but must stay at this position for 8.2 compat */
 	PG_UTF8,					/* Unicode UTF8 */
 	PG_MULE_INTERNAL,			/* Mule internal code */
 	PG_LATIN1,					/* ISO-8859-1 Latin 1 */
@@ -194,7 +195,6 @@
 	PG_BIG5,					/* Big5 (Windows-950) */
 	PG_GBK,						/* GBK (Windows-936) */
 	PG_UHC,						/* UHC (Windows-949) */
-	PG_JOHAB,					/* EUC for Korean JOHAB */
 	PG_GB18030,					/* GB18030 */
 	PG_SHIFT_JIS_2004,			/* Shift-JIS-2004 */
 	_PG_LAST_ENCODING_			/* mark only */

Attachment: signature.asc
Description: Digital signature

Reply via email to