]> granicus.if.org Git - postgresql/commit
Prevent a rowtype from being included in itself.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Mar 2011 19:45:14 +0000 (15:45 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Mar 2011 19:45:14 +0000 (15:45 -0400)
commitcfce572aceb0a8c809f5f52b7c8002b9917bcb19
treee4f7bd7e65a497007da63858f7532fda6af729e5
parent9951cf846199c2309854fe7d8b05b1fac6a5e904
Prevent a rowtype from being included in itself.

Eventually we might be able to allow that, but it's not clear how many
places need to be fixed to prevent infinite recursion when there's a direct
or indirect inclusion of a rowtype in itself.  One such place is
CheckAttributeType(), which will recurse to stack overflow in cases such as
those exhibited in bug #5950 from Alex Perepelica.  If we were sure it was
the only such place, we could easily modify the code added by this patch to
stop the recursion without a complaint ... but it probably isn't the only
such place.  Hence, throw error until such time as someone is excited
enough about this type of usage to put work into making it safe.

Back-patch as far as 8.3.  8.2 doesn't have the recursive call in
CheckAttributeType in the first place, so I see no need to add code there
in the absence of clear evidence of a problem elsewhere.
src/backend/catalog/heap.c
src/backend/commands/tablecmds.c
src/include/catalog/heap.h
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql