BUG #15729: Error 'invalid memory alloc request size' during updating a big xml field

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: varuzam(at)gmail(dot)com
Subject: BUG #15729: Error 'invalid memory alloc request size' during updating a big xml field
Date: 2019-04-02 15:53:33
Message-ID: 15729-bb65cf975dd7c6ca@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: 15729
Logged by: Kent
Email address: varuzam(at)gmail(dot)com
PostgreSQL version: 11.2
Operating system: Centos 7 64bit
Description:

Hello
I have a table with big records
```
test=# \d xrecords
Table "public.xrecords"
Column | Type | Collation | Nullable | Default
--------+---------------+-----------+----------+---------
recid | character(19) | | not null |
detail | xml | | |
data | oid | | |
Indexes:
"recidkey" PRIMARY KEY, btree (recid)
"delete_ix" btree (text((xpath('/detail/delete_date/text()'::text,
detail))[1]))
Triggers:
delete_all_trigger BEFORE TRUNCATE ON xrecords FOR EACH STATEMENT
EXECUTE PROCEDURE clean_all_data()
delete_trigger BEFORE DELETE ON xrecords FOR EACH ROW EXECUTE PROCEDURE
clean_data()
insert_or_update_trigger BEFORE INSERT ON xrecords FOR EACH ROW EXECUTE
PROCEDURE insert_or_update()
update_trigger BEFORE UPDATE ON xrecords FOR EACH ROW EXECUTE PROCEDURE
clean_data()

test=# select length(detail::text) from xrecords WHERE
recid='GU20190309070000020' ;
length
-----------
493514189
```

The error occurs during this query
```
test=# UPDATE xrecords SET detail = XMLPARSE (DOCUMENT
replace(text(detail),'<update_date>','<delete_date>2019-04-01
10:04:05</delete_date><update_date>')) WHERE recid='GU20190309070000020' AND
text((xpath('/detail/delete_date/text()', detail))[1]) IS NULL;

ERROR: invalid memory alloc request size 1974056760
```

is it a bug?

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2019-04-02 16:00:48 Re: BUG #15727: PANIC: cannot abort transaction 295144144, it was already committed
Previous Message Tom Lane 2019-04-02 15:51:38 Re: BUG #15727: PANIC: cannot abort transaction 295144144, it was already committed