Re: submitted WIN1252 patches are buggy - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: submitted WIN1252 patches are buggy
Date
Msg-id 200503141828.j2EIShj03329@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
I have added your new files to CVS and made a new patch for win1252
rather than using the ones you supplied, and it now works.  I also added
regression tests.  The patch is attached.  I installed your new files
too, with a slight renaming of function names for consistency.

There are a few other cleanups in the patch as well.

Anyway, with these changes, initdb and the regression tests now pass.

Thanks for working on this.

---------------------------------------------------------------------------

Roland Volkmann wrote:
> Hello Bruce,
>
> the decision to kick out the win1252-support from version 8.0 was
> absolutely correct: my patches were buggy!
>
> Meanwhile I have the build environment for native win32 code, and I
> could test the submitted patches. They don't work, so please delete what
> I had sent to you privately on 05.12.04
>
> I corrected the sources, and now I can build the win32 port of
> PostgreSQL with WIN1252-support. But there is still a big problem where
> I have no more ideas after having spent 3 days now without success.
>
> initdb throws the following error regardless the selected charset:
>
> > FATAL:  default conversion for WIN1250 to UNICODE already exists
> > child process was terminated by signal 1
> > initdb: removing data directory "D:/Programme/PostgreSQL/8.0.0-rc1/data"
>
> When using grep to check all areas for "win1250" I cannot find a
> duplicate declaration. Building the win32 port without the patches
> doesn't show this issue.
>
> Here is the overview of the modifications I use, current base is
> snapshot from 16.12.04:
>
>
>   Directory of  \doc\src\sgml\*
>
> 17.12.2004   2:12          29.040  charset.sgml           (changed file)
> 17.12.2004   2:18         309.928  func.sgml              (changed file)
> ----------------------------------------------------------------------------
>
>  Directory of  \src\backend\utils\mb\*
>
> 14.12.2004   0:36           9.417  encnames.c             (changed file)
> 14.12.2004   0:38          15.714  wchar.c                (changed file)
> ----------------------------------------------------------------------------
>
>  Directory of  \src\backend\utils\mb\conversion_procs\*
>
> 16.12.2004   3:37          10.793  Makefile               (changed file)
> ----------------------------------------------------------------------------
>
>  Directory of  \src\backend\utils\mb\conversion_procs\utf8_and_win1252\*
>
>  5.12.2004   3:28             475  Makefile               (new file)
>  5.12.2004   3:28           1.897  utf8_and_win1252.c     (new file)
> ----------------------------------------------------------------------------
>
>  Directory of  \src\backend\utils\mb\Unicode\*
>
>  5.12.2004   3:28           2.563  utf8_to_win1252.map    (new file)
>  8.12.2004   5:34           2.643  win1252_to_utf8.map    (new file)
> ----------------------------------------------------------------------------
>
>  Directory of  \src\bin\initdb\*
>
> 17.12.2004   1:27          61.231  initdb.c               (changed file)
> ----------------------------------------------------------------------------
>
>  Directory of  \src\Include\mb\*
>
> 14.12.2004   0:42          11.854  pg_wchar.h             (changed file)
> ----------------------------------------------------------------------------
>
>
> There are 3 ZIP files attached to this mail:
> - new_files.zip
> - changed_files.zip
> - patches.zip  (for changed files only)
>
> If you would have some spare time, perhaps you can give me a hint where
> to look for the (hopefully) last bug.
>
>
> With best regards,
>
> Roland.
>

[ application/x-zip-compressed is not supported, skipping... ]

[ application/x-zip-compressed is not supported, skipping... ]

[ application/x-zip-compressed is not supported, skipping... ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/charset.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v
retrieving revision 2.67
diff -c -c -r2.67 charset.sgml
*** doc/src/sgml/charset.sgml    14 Mar 2005 03:59:22 -0000    2.67
--- doc/src/sgml/charset.sgml    14 Mar 2005 18:10:19 -0000
***************
*** 537,542 ****
--- 537,549 ----
          <row>
           <entry><literal>WIN1251</literal></entry>
           <entry>Windows CP1251</entry>
+          <entry>Western European</entry>
+          <entry>1</entry>
+          <entry></entry>
+         </row>
+         <row>
+          <entry><literal>WIN1252</literal></entry>
+          <entry>Windows CP1252</entry>
           <entry>Cyrillic</entry>
           <entry>1</entry>
           <entry><literal>WIN</></entry>
***************
*** 676,682 ****
         <tbody>
          <row>
           <entry><literal>BIG5</literal></entry>
!          <entry><emphasis>not available as a server encoding</emphasis>
           </entry>
          </row>
          <row>
--- 683,689 ----
         <tbody>
          <row>
           <entry><literal>BIG5</literal></entry>
!          <entry><emphasis>not supported as a server encoding</emphasis>
           </entry>
          </row>
          <row>
***************
*** 711,722 ****
          </row>
          <row>
           <entry><literal>GB18030</literal></entry>
!          <entry><emphasis>not available as a server encoding</emphasis>
           </entry>
          </row>
          <row>
           <entry><literal>GBK</literal></entry>
!          <entry><emphasis>not available as a server encoding</emphasis>
           </entry>
          </row>
          <row>
--- 718,729 ----
          </row>
          <row>
           <entry><literal>GB18030</literal></entry>
!          <entry><emphasis>not supported as a server encoding</emphasis>
           </entry>
          </row>
          <row>
           <entry><literal>GBK</literal></entry>
!          <entry><emphasis>not supported as a server encoding</emphasis>
           </entry>
          </row>
          <row>
***************
*** 847,853 ****
          </row>
          <row>
           <entry><literal>SJIS</literal></entry>
!          <entry><emphasis>not available as a server encoding</emphasis>
           </entry>
          </row>
          <row>
--- 854,860 ----
          </row>
          <row>
           <entry><literal>SJIS</literal></entry>
!          <entry><emphasis>not supported as a server encoding</emphasis>
           </entry>
          </row>
          <row>
***************
*** 859,865 ****
          </row>
          <row>
           <entry><literal>UHC</literal></entry>
!          <entry><emphasis>not available as a server encoding</emphasis>
           </entry>
          </row>
          <row>
--- 866,872 ----
          </row>
          <row>
           <entry><literal>UHC</literal></entry>
!          <entry><emphasis>not supported as a server encoding</emphasis>
           </entry>
          </row>
          <row>
***************
*** 902,907 ****
--- 909,920 ----
           </entry>
          </row>
          <row>
+          <entry><literal>WIN1252</literal></entry>
+          <entry><emphasis>WIN1252</emphasis>,
+           <literal>UTF8</literal>
+          </entry>
+         </row>
+         <row>
           <entry><literal>WIN1256</literal></entry>
           <entry><emphasis>WIN1256</emphasis>,
           <literal>UTF8</literal>
Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.240
diff -c -c -r1.240 func.sgml
*** doc/src/sgml/func.sgml    7 Mar 2005 04:30:49 -0000    1.240
--- doc/src/sgml/func.sgml    14 Mar 2005 18:10:25 -0000
***************
*** 1991,1996 ****
--- 1991,2002 ----
        </row>

        <row>
+        <entry><literal>utf8_to_windows_1252</literal></entry>
+        <entry><literal>UTF8</literal></entry>
+        <entry><literal>WIN1252</literal></entry>
+       </row>
+
+       <row>
         <entry><literal>utf8_to_windows_1256</literal></entry>
         <entry><literal>UTF8</literal></entry>
         <entry><literal>WIN1256</literal></entry>
***************
*** 2057,2062 ****
--- 2063,2074 ----
        </row>

        <row>
+        <entry><literal>windows_1252_to_utf8</literal></entry>
+        <entry><literal>WIN1252</literal></entry>
+        <entry><literal>UTF8</literal></entry>
+       </row>
+
+       <row>
         <entry><literal>windows_1256_to_utf8</literal></entry>
         <entry><literal>WIN1256</literal></entry>
         <entry><literal>UTF8</literal></entry>
Index: src/backend/utils/mb/encnames.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mb/encnames.c,v
retrieving revision 1.24
diff -c -c -r1.24 encnames.c
*** src/backend/utils/mb/encnames.c    13 Mar 2005 01:26:30 -0000    1.24
--- src/backend/utils/mb/encnames.c    14 Mar 2005 18:10:27 -0000
***************
*** 194,199 ****
--- 194,202 ----
          "win1251", PG_WIN1251
      },                            /* alias for Windows-1251 */
      {
+         "win1252", PG_WIN1252
+     },                            /* alias for Windows-1252 */
+     {
          "win1256", PG_WIN1256
      },                            /* alias for Windows-1256 */
      {
***************
*** 224,229 ****
--- 227,235 ----
          "windows1251", PG_WIN1251
      },                            /* Windows-1251; Microsoft */
      {
+         "windows1252", PG_WIN1252
+     },                            /* Windows-1252; Microsoft */
+     {
          "windows1256", PG_WIN1256
      },                            /* Windows-1256; Microsoft */
      {
***************
*** 335,340 ****
--- 341,349 ----
          "WIN1251", PG_WIN1251
      },
      {
+         "WIN1252", PG_WIN1252
+     },
+     {
          "ISO_8859_5", PG_ISO_8859_5
      },
      {
Index: src/backend/utils/mb/wchar.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mb/wchar.c,v
retrieving revision 1.42
diff -c -c -r1.42 wchar.c
*** src/backend/utils/mb/wchar.c    14 Mar 2005 00:19:13 -0000    1.42
--- src/backend/utils/mb/wchar.c    14 Mar 2005 18:10:27 -0000
***************
*** 738,743 ****
--- 738,744 ----
      {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1},    /* 20; PG_WIN874 */
      {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1},    /* 21; PG_KOI8 */
      {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1},    /* 22; PG_WIN1251 */
+     {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1},    /* 22; PG_WIN1252 */
      {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1},    /* 23; PG_WIN866 */
      {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1},    /* 24; ISO-8859-5 */
      {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1},    /* 25; ISO-8859-6 */
Index: src/backend/utils/mb/conversion_procs/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/Makefile,v
retrieving revision 1.12
diff -c -c -r1.12 Makefile
*** src/backend/utils/mb/conversion_procs/Makefile    7 Mar 2005 04:30:52 -0000    1.12
--- src/backend/utils/mb/conversion_procs/Makefile    14 Mar 2005 18:10:31 -0000
***************
*** 24,30 ****
      utf8_and_euc_jp utf8_and_euc_kr utf8_and_euc_tw utf8_and_gb18030 \
      utf8_and_gbk utf8_and_iso8859 utf8_and_iso8859_1 utf8_and_johab \
      utf8_and_sjis utf8_and_win1258 utf8_and_uhc utf8_and_win1250 \
!     utf8_and_win1256 utf8_and_win874

  # conversion_name source_encoding destination_encoding function object
  CONVERSIONS = \
--- 24,30 ----
      utf8_and_euc_jp utf8_and_euc_kr utf8_and_euc_tw utf8_and_gb18030 \
      utf8_and_gbk utf8_and_iso8859 utf8_and_iso8859_1 utf8_and_johab \
      utf8_and_sjis utf8_and_win1258 utf8_and_uhc utf8_and_win1250 \
!     utf8_and_win1252 utf8_and_win1256 utf8_and_win874

  # conversion_name source_encoding destination_encoding function object
  CONVERSIONS = \
***************
*** 86,91 ****
--- 86,93 ----
          koi8_r_to_utf8    KOI8R UTF8 koi8r_to_utf8 utf8_and_cyrillic \
          utf8_to_windows_1251    UTF8 WIN1251 utf8_to_win1251 utf8_and_cyrillic \
          windows_1251_to_utf8    WIN1251 UTF8 win1251_to_utf8 utf8_and_cyrillic \
+         utf8_to_windows_1252    UTF8 WIN1252 utf8_to_win1252 utf8_and_win1252 \
+         windows_1252_to_utf8    WIN1252 UTF8 win1252_to_utf8 utf8_and_win1252 \
          utf8_to_windows_866    UTF8 WIN866 utf8_to_win866 utf8_and_cyrillic \
          windows_866_to_utf8    WIN866 UTF8 win866_to_utf8 utf8_and_cyrillic \
          euc_cn_to_utf8 EUC_CN UTF8 euc_cn_to_utf8 utf8_and_euc_cn \
***************
*** 136,147 ****
          utf8_to_win1258 UTF8 WIN1258 utf8_to_win1258 utf8_and_win1258 \
          uhc_to_utf8 UHC UTF8 uhc_to_utf8 utf8_and_uhc \
          utf8_to_uhc UTF8 UHC utf8_to_uhc utf8_and_uhc \
!         utf8_to_windows_1250  UTF8 WIN1250 utf_to_win1250 utf8_and_win1250 \
!         windows_1250_to_utf8  WIN1250 UTF8 win1250_to_utf utf8_and_win1250 \
!         utf8_to_windows_1256  UTF8 WIN1256 utf_to_win1256 utf8_and_win1256 \
!         windows_1256_to_utf8  WIN1256 UTF8 win1256_to_utf utf8_and_win1256 \
!         utf8_to_windows_874  UTF8 WIN874 utf_to_win874 utf8_and_win874 \
!         windows_874_to_utf8  WIN874 UTF8 win874_to_utf utf8_and_win874

  all: $(SQLSCRIPT)
      @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
--- 138,149 ----
          utf8_to_win1258 UTF8 WIN1258 utf8_to_win1258 utf8_and_win1258 \
          uhc_to_utf8 UHC UTF8 uhc_to_utf8 utf8_and_uhc \
          utf8_to_uhc UTF8 UHC utf8_to_uhc utf8_and_uhc \
!         utf8_to_windows_1250  UTF8 WIN1250 utf8_to_win1250 utf8_and_win1250 \
!         windows_1250_to_utf8  WIN1250 UTF8 win1250_to_utf8 utf8_and_win1250 \
!         utf8_to_windows_1256  UTF8 WIN1256 utf8_to_win1256 utf8_and_win1256 \
!         windows_1256_to_utf8  WIN1256 UTF8 win1256_to_utf8 utf8_and_win1256 \
!         utf8_to_windows_874  UTF8 WIN874 utf8_to_win874 utf8_and_win874 \
!         windows_874_to_utf8  WIN874 UTF8 win874_to_utf8 utf8_and_win874

  all: $(SQLSCRIPT)
      @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
Index: src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v
retrieving revision 1.12
diff -c -c -r1.12 utf8_and_iso8859.c
*** src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c    7 Mar 2005 04:30:54 -0000    1.12
--- src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c    14 Mar 2005 18:10:31 -0000
***************
*** 108,114 ****
      {PG_WIN1258},                /* Windows-1258 */
      {PG_WIN874},                /* windows-874 */
      {PG_KOI8R},                    /* KOI8-R */
!     {PG_WIN1251},                /* windows-1251 (was: WIN) */
      {PG_WIN866},                /* (MS-DOS CP866) */
      {PG_ISO_8859_5, LUmapISO8859_5, ULmapISO8859_5,
          sizeof(LUmapISO8859_5) / sizeof(pg_local_to_utf),
--- 108,114 ----
      {PG_WIN1258},                /* Windows-1258 */
      {PG_WIN874},                /* windows-874 */
      {PG_KOI8R},                    /* KOI8-R */
!     {PG_WIN1251},                /* windows-1251 */
      {PG_WIN866},                /* (MS-DOS CP866) */
      {PG_ISO_8859_5, LUmapISO8859_5, ULmapISO8859_5,
          sizeof(LUmapISO8859_5) / sizeof(pg_local_to_utf),
Index: src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c,v
retrieving revision 1.10
diff -c -c -r1.10 utf8_and_win1250.c
*** src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c    7 Mar 2005 04:30:54 -0000    1.10
--- src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c    14 Mar 2005 18:10:32 -0000
***************
*** 17,27 ****
  #include "../../Unicode/utf8_to_win1250.map"
  #include "../../Unicode/win1250_to_utf8.map"

! PG_FUNCTION_INFO_V1(utf_to_win1250);
! PG_FUNCTION_INFO_V1(win1250_to_utf);

! extern Datum utf_to_win1250(PG_FUNCTION_ARGS);
! extern Datum win1250_to_utf(PG_FUNCTION_ARGS);

  /* ----------
   * conv_proc(
--- 17,27 ----
  #include "../../Unicode/utf8_to_win1250.map"
  #include "../../Unicode/win1250_to_utf8.map"

! PG_FUNCTION_INFO_V1(utf8_to_win1250);
! PG_FUNCTION_INFO_V1(win1250_to_utf8);

! extern Datum utf8_to_win1250(PG_FUNCTION_ARGS);
! extern Datum win1250_to_utf8(PG_FUNCTION_ARGS);

  /* ----------
   * conv_proc(
***************
*** 35,41 ****
   */

  Datum
! utf_to_win1250(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
--- 35,41 ----
   */

  Datum
! utf8_to_win1250(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
***************
*** 52,58 ****
  }

  Datum
! win1250_to_utf(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
--- 52,58 ----
  }

  Datum
! win1250_to_utf8(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
Index: src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c,v
retrieving revision 1.10
diff -c -c -r1.10 utf8_and_win1256.c
*** src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c    7 Mar 2005 04:30:54 -0000    1.10
--- src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c    14 Mar 2005 18:10:32 -0000
***************
*** 17,27 ****
  #include "../../Unicode/utf8_to_win1256.map"
  #include "../../Unicode/win1256_to_utf8.map"

! PG_FUNCTION_INFO_V1(utf_to_win1256);
! PG_FUNCTION_INFO_V1(win1256_to_utf);

! extern Datum utf_to_win1256(PG_FUNCTION_ARGS);
! extern Datum win1256_to_utf(PG_FUNCTION_ARGS);

  /* ----------
   * conv_proc(
--- 17,27 ----
  #include "../../Unicode/utf8_to_win1256.map"
  #include "../../Unicode/win1256_to_utf8.map"

! PG_FUNCTION_INFO_V1(utf8_to_win1256);
! PG_FUNCTION_INFO_V1(win1256_to_utf8);

! extern Datum utf8_to_win1256(PG_FUNCTION_ARGS);
! extern Datum win1256_to_utf8(PG_FUNCTION_ARGS);

  /* ----------
   * conv_proc(
***************
*** 35,41 ****
   */

  Datum
! utf_to_win1256(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
--- 35,41 ----
   */

  Datum
! utf8_to_win1256(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
***************
*** 52,58 ****
  }

  Datum
! win1256_to_utf(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
--- 52,58 ----
  }

  Datum
! win1256_to_utf8(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
Index: src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c,v
retrieving revision 1.10
diff -c -c -r1.10 utf8_and_win874.c
*** src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c    7 Mar 2005 04:30:55 -0000    1.10
--- src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c    14 Mar 2005 18:10:32 -0000
***************
*** 17,27 ****
  #include "../../Unicode/utf8_to_win874.map"
  #include "../../Unicode/win874_to_utf8.map"

! PG_FUNCTION_INFO_V1(utf_to_win874);
! PG_FUNCTION_INFO_V1(win874_to_utf);

! extern Datum utf_to_win874(PG_FUNCTION_ARGS);
! extern Datum win874_to_utf(PG_FUNCTION_ARGS);

  /* ----------
   * conv_proc(
--- 17,27 ----
  #include "../../Unicode/utf8_to_win874.map"
  #include "../../Unicode/win874_to_utf8.map"

! PG_FUNCTION_INFO_V1(utf8_to_win874);
! PG_FUNCTION_INFO_V1(win874_to_utf8);

! extern Datum utf8_to_win874(PG_FUNCTION_ARGS);
! extern Datum win874_to_utf8(PG_FUNCTION_ARGS);

  /* ----------
   * conv_proc(
***************
*** 35,41 ****
   */

  Datum
! utf_to_win874(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
--- 35,41 ----
   */

  Datum
! utf8_to_win874(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
***************
*** 52,58 ****
  }

  Datum
! win874_to_utf(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
--- 52,58 ----
  }

  Datum
! win874_to_utf8(PG_FUNCTION_ARGS)
  {
      unsigned char *src = PG_GETARG_CSTRING(2);
      unsigned char *dest = PG_GETARG_CSTRING(3);
Index: src/bin/initdb/initdb.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.78
diff -c -c -r1.78 initdb.c
*** src/bin/initdb/initdb.c    11 Mar 2005 15:36:27 -0000    1.78
--- src/bin/initdb/initdb.c    14 Mar 2005 18:10:32 -0000
***************
*** 764,769 ****
--- 764,770 ----
      {PG_LATIN10, "ISO8859-16"},
      {PG_LATIN10, "iso885916"},

+     {PG_WIN1252, "CP1252"},
      {PG_WIN1256, "CP1256"},
      {PG_WIN1258, "CP1258"},
  #ifdef NOT_VERIFIED
Index: src/include/mb/pg_wchar.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/mb/pg_wchar.h,v
retrieving revision 1.57
diff -c -c -r1.57 pg_wchar.h
*** src/include/mb/pg_wchar.h    7 Mar 2005 04:30:55 -0000    1.57
--- src/include/mb/pg_wchar.h    14 Mar 2005 18:10:33 -0000
***************
*** 172,178 ****
      PG_WIN866,                    /* (MS-DOS CP866) */
      PG_WIN874,                    /* windows-874 */
      PG_KOI8R,                    /* KOI8-R */
!     PG_WIN1251,                    /* windows-1251 (was: WIN) */
      PG_ISO_8859_5,                /* ISO-8859-5 */
      PG_ISO_8859_6,                /* ISO-8859-6 */
      PG_ISO_8859_7,                /* ISO-8859-7 */
--- 172,179 ----
      PG_WIN866,                    /* (MS-DOS CP866) */
      PG_WIN874,                    /* windows-874 */
      PG_KOI8R,                    /* KOI8-R */
!     PG_WIN1251,                    /* windows-1251 */
!     PG_WIN1252,                    /* windows-1252 */
      PG_ISO_8859_5,                /* ISO-8859-5 */
      PG_ISO_8859_6,                /* ISO-8859-6 */
      PG_ISO_8859_7,                /* ISO-8859-7 */
Index: src/test/regress/expected/conversion.out
===================================================================
RCS file: /cvsroot/pgsql/src/test/regress/expected/conversion.out,v
retrieving revision 1.10
diff -c -c -r1.10 conversion.out
*** src/test/regress/expected/conversion.out    7 Mar 2005 04:30:55 -0000    1.10
--- src/test/regress/expected/conversion.out    14 Mar 2005 18:10:35 -0000
***************
*** 784,789 ****
--- 784,815 ----
   foo
  (1 row)

+ -- UTF8 --> WIN1252
+ SELECT CONVERT('foo' USING utf8_to_windows_1252);
+  convert_using
+ ---------------
+  foo
+ (1 row)
+
+ SELECT CONVERT('foo', 'UTF8', 'WIN1252');
+  convert
+ ---------
+  foo
+ (1 row)
+
+ -- WIN1252 --> UTF8
+ SELECT CONVERT('foo' USING windows_1252_to_utf8);
+  convert_using
+ ---------------
+  foo
+ (1 row)
+
+ SELECT CONVERT('foo', 'WIN1252', 'UTF8');
+  convert
+ ---------
+  foo
+ (1 row)
+
  -- UTF8 --> WIN866
  SELECT CONVERT('foo' USING utf8_to_windows_866);
   convert_using
Index: src/test/regress/sql/conversion.sql
===================================================================
RCS file: /cvsroot/pgsql/src/test/regress/sql/conversion.sql,v
retrieving revision 1.7
diff -c -c -r1.7 conversion.sql
*** src/test/regress/sql/conversion.sql    7 Mar 2005 04:30:55 -0000    1.7
--- src/test/regress/sql/conversion.sql    14 Mar 2005 18:10:35 -0000
***************
*** 201,206 ****
--- 201,212 ----
  -- WIN1251 --> UTF8
  SELECT CONVERT('foo' USING windows_1251_to_utf8);
  SELECT CONVERT('foo', 'WIN1251', 'UTF8');
+ -- UTF8 --> WIN1252
+ SELECT CONVERT('foo' USING utf8_to_windows_1252);
+ SELECT CONVERT('foo', 'UTF8', 'WIN1252');
+ -- WIN1252 --> UTF8
+ SELECT CONVERT('foo' USING windows_1252_to_utf8);
+ SELECT CONVERT('foo', 'WIN1252', 'UTF8');
  -- UTF8 --> WIN866
  SELECT CONVERT('foo' USING utf8_to_windows_866);
  SELECT CONVERT('foo', 'UTF8', 'WIN866');

pgsql-patches by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [GENERAL] A way to let Vacuum warn if FSM settings
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] A way to let Vacuum warn if FSM settings are