BUG #14497: 1G bytea insert error

From: nikolay(dot)nikitin(at)infowatch(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14497: 1G bytea insert error
Date: 2017-01-16 12:57:51
Message-ID: 20170116125751.1432.67469@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14497
Logged by: Nikolay Nikitin
Email address: nikolay(dot)nikitin(at)infowatch(dot)com
PostgreSQL version: 9.4.10
Operating system: Red Hat Enterprise Linux Server release 6.7
Description:

Hi! I try to insert 1G bytea value into the simple table and get the
error.

drop table if exists test;

create table test
(
blob bytea
);

insert into test(blob) select string_agg(gen_random_bytes(1024 - case when g
= 1024 then 52 else 0 end), null::bytea)::bytea from generate_series(1, 1024
* 1024) g;

ERROR: invalid memory alloc request size 1073741824
********** Ошибка **********

ERROR: invalid memory alloc request size 1073741824
SQL-состояние: XX000

Value equal or greater 1G-52 raises the error. But smaller value inserts
without errors.

insert into test(blob) select string_agg(gen_random_bytes(1024 - case when g
= 1024 then 53 else 0 end), null::bytea)::bytea from generate_series(1, 1024
* 1024) g;
Query returned successfully: one row affected, 02:04 minutes execution
time.

I think 1G has to be inserted without errors.

Regards, Nikolay.

Browse pgsql-bugs by date

  From Date Subject
Next Message liomry 2017-01-16 13:35:08 BUG #14498: Default role should be case sensitive when created in Windows
Previous Message zszabo 2017-01-16 11:16:16 BUG #14496: Cost of comparator is not taken into account in sorting