1 -- Check that stack depth detection mechanism works and
2 -- max_stack_depth is not set too high.
3 create function infinite_recurse() returns int as
4 'select infinite_recurse()' language sql;
5 -- Unfortunately, up till mid 2020 the Linux kernel had a bug in PPC64
6 -- signal handling that would cause this test to crash if it happened
7 -- to receive an sinval catchup interrupt while the stack is deep:
8 -- https://bugzilla.kernel.org/show_bug.cgi?id=205183
9 -- It is likely to be many years before that bug disappears from all
10 -- production kernels, so disable this test on such platforms.
11 -- (We still create the function, so as not to have a cross-platform
12 -- difference in the end state of the regression database.)
13 SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
18 -- The full error report is not very stable, so we show only SQLSTATE
19 -- and primary error message.
20 \set VERBOSITY sqlstate
21 select infinite_recurse();
23 \echo :LAST_ERROR_MESSAGE
24 stack depth limit exceeded