Re: BUG #16369: Segmentation Faults and Data Corruption withGenerated Columns - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #16369: Segmentation Faults and Data Corruption withGenerated Columns
Date
Msg-id CAApHDvrDuAngJCAjhBEsPtWAgm4RzQ67T5shvATKgyaysvX0wA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16369: Segmentation Faults and Data Corruption withGenerated Columns  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-bugs
On Fri, 17 Apr 2020 at 21:04, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
>
> I've tried creating a smaller test case, but it's difficult.  I haven't
> fully understood the reason why it sometimes crashes and sometimes not.
>
> The smallest I could come up with so far is something like this:
>
> CREATE TABLE crash (
>      hostname varchar,
>      hostname_short varchar GENERATED ALWAYS AS (hostname) STORED,
>      device text,
>      mount text,
>      used_space_bytes bigint,
>      avail_space_bytes bigint
> );
> INSERT INTO crash (hostname, device, mount, used_space_bytes,
> avail_space_bytes) VALUES (repeat('1234567890', 100), 'devtmpfs',
> '/dev', 0, 6047076131313);
>
> Would this be easier to reproduce with one of the memory-cleaning
> #defines enabled?

I've done a bit more work on this and have something close. The case I
came up with for it was:

+CREATE TABLE gtest_varlena (a varchar, b varchar GENERATED ALWAYS AS
(a) STORED);
+INSERT INTO gtest_varlena (a) VALUES('01234567890123456789');
+INSERT INTO gtest_varlena (a) VALUES(NULL);
+SELECT * FROM gtest_varlena ORDER BY a;
+          a           |          b
+----------------------+----------------------
+ 01234567890123456789 | 01234567890123456789
+                      |
+(2 rows)
+
+DROP TABLE gtest_varlena;

With that, on an unpatched server, there's no crash, but there's
clearly junk in the b column.



pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #16369: Segmentation Faults and Data Corruption withGenerated Columns
Next
From: PG Bug reporting form
Date:
Subject: BUG #16374: I can't directly change owner from my created database to my created user.