Обсуждение: Server broken down in covering GB18030
Encoding in UTF-8 Bug: C:\PostgreSQL>ver Microsoft Windows [版本 5.2.3790] C:\PostgreSQL>mkdir data C:\PostgreSQL>bin\initdb -D data C:\PostgreSQL>bin\postmaster -D data C:\PostgreSQL\bin>psql -d template1 template1=# select version(); PostgreSQL 8.0.3 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special) template1=# create database test1 encoding 'unicode'; template1=# \l 数据库列表 名字 | 所有者 | 编码 -----------+--------+-----------template0 | YaYo | SQL_ASCIItemplate1 | YaYo | SQL_ASCIItest1 | YaYo | UNICODE template1=# \c test1 你现在已经联接到数据库 "test1". test1=# \encoding UNICODE test1=# select; 错误: 语法错误 在 ";" 或附近的 在字符 7 第 1 行: select; test1=# \encoding gb18030 test1=# \encoding GB18030 test1=# select; 服务器意外地关闭了联接 这种现象通常意味着服务器在处理请求之前 或者正在处理请求的时候意外中止 与服务器的联接已丢失. 尝试重置: 失败. !> Server Log: 比致命错误还过分的错误: ERRORDATA_STACK_SIZE exceeded 语句: select; 警告: 忽略不能转换的 UTF-8 字符 0xc8d6 警告: 忽略不能转换的 UTF-8 字符 0xe60000 警告: 忽略不能转换的 UTF-8 字符 0xe60000 日志: 服务器进程 (PID 3616) 被信号 125 中断 日志: 中断任何其它已激活的服务器进程 致命错误: 数据库系统在恢复模式中 日志: 所有的服务器进程被中止; 重新初始化 日志: 数据库系统在 2005-07-29 17:08:08 中国标准时间 被中断 日志: checkpoint 记录位置在 0/ABCEC0 日志: redo record is at 0/ABCEC0; undo record is at 0/0; shutdown FALSE 日志: 下一个事物 ID: 558; 下一个 OID: 25422 日志: 数据库系统没有正确的关闭; 自动恢复 日志: 在 0/ABCF00 位置有零长度的记录 日志: 不需要 redo 日志: 数据库系统准备就绪 Debug: C:\PostgreSQL>ren share\locale\zh_CN zh_CN.disable C:\PostgreSQL>bin\postmaster -D data C:\PostgreSQL\bin>psql -d template1 template1=# \l List of databases Name | Owner | Encoding -----------+-------+-----------template0 | YaYo | SQL_ASCIItemplate1 | YaYo | SQL_ASCIItest1 | YaYo | UNICODE template1=# \c test1 You are now connected to database "test1". test1=# \encoding UNICODE test1=# select; ERROR: syntax error at or near ";" at character 7 LINE 1: select; test1=# \encoding gb18030 test1=# \encoding GB18030 test1=# select; ERROR: syntax error at or near ";" at character 7 LINE 1: select; test1=# \q
My theory is "select;" incurs a parse error and this error message is supposed to be translated into your encoding, but unfortunately not every UTF8 character is necessarily be encoded as GB18030, which will cause an infinite recursive elogs just like this: 1:elog(parse_error) // contain unencodable characters 2: elog(report_not_translatable) // contain unencodable characters again 3: elog(report_report_not_translatable) 4: elog(report_report_report_not_translatable) 5: ... and corrupt the elog stack. To fix this, we could just print a "Unsupport encoding" message which is just a plain ascii character string and stop the recursion at step 3. Regards, Qingqing "Ñîçß" <yayooo@gmail.com> writes > template1=# select version(); > PostgreSQL 8.0.3 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) > 3.4.2 (mingw-special) > template1=# create database test1 encoding 'unicode'; > test1=# \encoding > UNICODE > test1=# \encoding gb18030 > test1=# \encoding > GB18030 > test1=# select; ... > ±ÈÖÂÃü´íÎó»¹¹ý·ÖµÄ´íÎó: ERRORDATA_STACK_SIZE exceeded
Has this been fixed already? --------------------------------------------------------------------------- Qingqing Zhou wrote: > > My theory is "select;" incurs a parse error and this error message is > supposed to be translated into your encoding, but unfortunately not every > UTF8 character is necessarily be encoded as GB18030, which will cause an > infinite recursive elogs just like this: > > 1:elog(parse_error) // contain unencodable characters > 2: elog(report_not_translatable) // contain unencodable characters > again > 3: elog(report_report_not_translatable) > 4: elog(report_report_report_not_translatable) > 5: ... > > and corrupt the elog stack. > > To fix this, we could just print a "Unsupport encoding" message which is > just a plain ascii character string and stop the recursion at step 3. > > Regards, > Qingqing > > "Ñîçß" <yayooo@gmail.com> writes > > template1=# select version(); > > PostgreSQL 8.0.3 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) > > 3.4.2 (mingw-special) > > template1=# create database test1 encoding 'unicode'; > > test1=# \encoding > > UNICODE > > test1=# \encoding gb18030 > > test1=# \encoding > > GB18030 > > test1=# select; > ... > > ±ÈÖÂÃü´íÎó»¹¹ý·ÖµÄ´íÎó: ERRORDATA_STACK_SIZE exceeded > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- 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
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Has this been fixed already? No. My suggestion of using bind_textdomain_codeset() might fix it, but I'm not sufficiently familiar with the NLS code to want to try to install that myself. regards, tom lane