The following bug has been logged online:
Bug reference: 2580
Logged by: Alex Zhang
Email address: zhangxuehu@gmail.com
PostgreSQL version: 8.1.4-1
Operating system: Windows XP sp2 and Windows 2003 Server
Description: Analyze table cause invalid memory alloc error in "start
with xx" select statement
Details:
When installing postgresql with China-PRC locale and UTF8 Encoding, it
causes the following problem:
After running "analyze", or "vacuum with analyze" commands on a table or
database, select statements with "like 'a%'" kind of clause report "invalid
memory alloc request size" error 2147483648" and yields no results.
There is 43 rows in my table and it worked fine before with mysql.
I have exported a database dump that can reliably recreate this problem. I
can send it if you give me an email address.
Just restore the data (with some foreign key errors that can be ignored) and
run
select * from element where name like 'a%';
you get 0 records, which is correct.
then run
analyze element;
select * from element where name like 'a%';
you get: ERROR: invalid memory alloc request size 2147483648.
Note that this error does not occur if I install the postgresql with locale
set to "C". I can also avoid this problem by setting the particular database
encoding to EUC_CN (when installed with China-PRC locale).