Some people have requested to add WIN1250 as an allowed server encoding. So far, the order of the encoding numbers determined which ones were client-only, so in order not to renumber the encodings, I could only come up with the attached ugly solution. If no one thinks of a better one, we'll go with that.
It would also be good if someone who has an environment that calls for WIN1250 (that is, Windows and an appropriate language environment) could test whether this actually does anything besides compiling without errors. :) -- Peter Eisentraut http://developer.postgresql.org/~petere/
diff -cr ../cvs-pgsql/src/include/mb/pg_wchar.h ./src/include/mb/pg_wchar.h *** ../cvs-pgsql/src/include/mb/pg_wchar.h 2004-09-11 00:10:58.000000000 +0200 --- ./src/include/mb/pg_wchar.h 2004-09-15 16:51:40.000000000 +0200 *************** *** 143,149 **** * in the pg_enc2name[] (mb/encnames.c) array! * * If you add some encoding don'y forget check ! * PG_ENCODING_[BE|FE]_LAST macros. * * The PG_SQL_ASCII is default encoding and must be = 0. */ --- 143,149 ---- * in the pg_enc2name[] (mb/encnames.c) array! * * If you add some encoding don'y forget check ! * PG_VALID_[BE|FE]_ENCODING macros. * * The PG_SQL_ASCII is default encoding and must be = 0. */ *************** *** 177,210 **** PG_ISO_8859_6, /* ISO-8859-6 */ PG_ISO_8859_7, /* ISO-8859-7 */ PG_ISO_8859_8, /* ISO-8859-8 */ ! ! /* followings are for client encoding only */ ! PG_SJIS, /* Shift JIS (Winindows-932) */ ! PG_BIG5, /* Big5 (Windows-950) */ ! PG_GBK, /* GBK (Windows-936) */ ! PG_UHC, /* UHC (Windows-949) */ PG_WIN1250, /* windows-1250 */ ! PG_GB18030, /* GB18030 */ _PG_LAST_ENCODING_ /* mark only */ } pg_enc; - #define PG_ENCODING_BE_LAST PG_ISO_8859_8 - #define PG_ENCODING_FE_LAST PG_GB18030 /* * Please use these tests before access to pg_encconv_tbl[] * or to other places... */ - #define PG_VALID_BE_ENCODING(_enc) \ - ((_enc) >= 0 && (_enc) <= PG_ENCODING_BE_LAST) - - #define PG_ENCODING_IS_CLIEN_ONLY(_enc) \ - (((_enc) > PG_ENCODING_BE_LAST && (_enc) <= PG_ENCODING_FE_LAST) - #define PG_VALID_ENCODING(_enc) \ ((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_) /* On FE are possible all encodings */ #define PG_VALID_FE_ENCODING(_enc) PG_VALID_ENCODING(_enc) --- 177,211 ---- PG_ISO_8859_6, /* ISO-8859-6 */ PG_ISO_8859_7, /* ISO-8859-7 */ PG_ISO_8859_8, /* ISO-8859-8 */ ! PG_SJIS, /* Shift JIS (Winindows-932), client only */ ! PG_BIG5, /* Big5 (Windows-950), client only */ ! PG_GBK, /* GBK (Windows-936), client only */ ! PG_UHC, /* UHC (Windows-949), client only */ PG_WIN1250, /* windows-1250 */ ! PG_GB18030, /* GB18030, client only */ _PG_LAST_ENCODING_ /* mark only */ } pg_enc; /* * Please use these tests before access to pg_encconv_tbl[] * or to other places... */ #define PG_VALID_ENCODING(_enc) \ ((_enc) >= 0 && (_enc) < _PG_LAST_ENCODING_) + #define PG_ENCODING_IS_CLIENT_ONLY(_enc) \ + (PG_VALID_ENCODING(_enc) \ + && (((_enc) == PG_SJIS) \ + || ((_enc) == PG_BIG5) \ + || ((_enc) == PG_GBK) \ + || ((_enc) == PG_UHC) \ + || ((_enc) == PG_GB18030))) + + #define PG_VALID_BE_ENCODING(_enc) \ + (PG_VALID_ENCODING(_enc) && !PG_ENCODING_IS_CLIENT_ONLY(_enc)) + /* On FE are possible all encodings */ #define PG_VALID_FE_ENCODING(_enc) PG_VALID_ENCODING(_enc) Nur in ./src: Makefile.custom.
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend