Re: tablecmds.c/MergeAttributes() cleanup
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Hi Alexander, On Sun, Jan 28, 2024 at 1:30 PM Alexander Lakhin <exclusion@gmail.com> wrote: > > Hello Peter, > > 26.01.2024 16:42, Peter Eisentraut wrote: > > > > I have committed all this. These are great improvements. > > > > Please look at the segmentation fault triggered by the following query since > 4d969b2f8: > CREATE TABLE t1(a text COMPRESSION pglz); > CREATE TABLE t2(a text); > CREATE TABLE t3() INHERITS(t1, t2); > NOTICE: merging multiple inherited definitions of column "a" > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while processing the request. > > Core was generated by `postgres: law regression [local] CREATE TABLE '. > Program terminated with signal SIGSEGV, Segmentation fault. > > (gdb) bt > #0 __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:116 > #1 0x00005606fbcc9d52 in MergeAttributes (columns=0x0, supers=supers@entry=0x5606fe293d30, relpersistence=112 'p', > is_partition=false, supconstr=supconstr@entry=0x7fff4046d410, supnotnulls=supnotnulls@entry=0x7fff4046d418) > at tablecmds.c:2811 > #2 0x00005606fbccd764 in DefineRelation (stmt=stmt@entry=0x5606fe26a130, relkind=relkind@entry=114 'r', ownerId=10, > ownerId@entry=0, typaddress=typaddress@entry=0x0, > queryString=queryString@entry=0x5606fe2695c0 "CREATE TABLE t3() INHERITS(t1, t2);") at tablecmds.c:885 This bug existed even before the refactoring.Happens because strcmp() is called on NULL input (t2's compression is NULL). I already have a fix for this and will be posting it in [1]. [1] https://www.postgresql.org/message-id/flat/24656cec-d6ef-4d15-8b5b-e8dfc9c833a7%40eisentraut.org -- Best Wishes, Ashutosh Bapat
Commits
-
Fix segmentation fault in MergeInheritedAttribute()
- 8f0a97dfffc5 17.0 landed
-
Improve compression and storage support with inheritance
- 0413a556990b 17.0 cited
-
Split some code out from MergeAttributes()
- f7cf9494bad3 17.0 landed
-
MergeAttributes code deduplication
- 64444ce071f6 17.0 landed
-
Add a const decoration
- 924d046dcf55 17.0 landed
-
MergeAttributes: convert pg_attribute back to ColumnDef before comparing
- 4d969b2f85e1 17.0 landed
-
Refactor ATExecAddColumn() to use BuildDescForRelation()
- a1604237a6ff 17.0 landed
-
Move BuildDescForRelation() from tupdesc.c to tablecmds.c
- 04e485273b56 17.0 landed
-
Push attcompression and attstorage handling into BuildDescForRelation()
- 180e3394a704 17.0 landed
-
Push attidentity and attgenerated handling into BuildDescForRelation()
- 6d341407a6e3 17.0 landed
-
Add TupleDescGetDefault()
- ebf76f2753a9 17.0 landed
-
MergeAttributes() and related variable renaming
- b0ae29512c21 17.0 landed
-
Clean up MergeCheckConstraint()
- 369202bf4be6 17.0 landed
-
Clean up MergeAttributesIntoExisting()
- eddad679d2ab 17.0 landed
-
Remove useless if condition
- 6844d3275ac6 17.0 landed
- 689c66a84bb7 17.0 landed
-
Make more use of makeColumnDef()
- 1fa9241bdd0e 17.0 landed
-
Add some const decorations
- 2b088c8e4a2c 17.0 landed
-
Remove ancient special case code for dropping oid columns
- 7ef2912519fd 17.0 landed
-
Remove ancient special case code for adding oid columns
- 5eaa0e92ee2f 17.0 landed
-
Remove obsolete comment about OID support
- adf333b4edb2 17.0 landed