PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15729
PG Version11.2
OSCentos 7 64bit
Opened2019-04-02 15:53:33+00
Reported byKent
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15729
Logged by:          Kent
Email address:      (redacted)
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?

Messages

DateAuthorSubject
2019-04-02 15:53:33+00PG Bug reporting formBUG #15729: Error 'invalid memory alloc request size' during updating a big xml field