File: infinite_recurse.sql

package info (click to toggle)
libpg-query 15-4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 28,320 kB
  • sloc: ansic: 163,581; sql: 69,531; ruby: 1,363; makefile: 247; cpp: 220
file content (29 lines) | stat: -rw-r--r-- 995 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- Check that stack depth detection mechanism works and
-- max_stack_depth is not set too high.

create function infinite_recurse() returns int as
'select infinite_recurse()' language sql;

-- Unfortunately, up till mid 2020 the Linux kernel had a bug in PPC64
-- signal handling that would cause this test to crash if it happened
-- to receive an sinval catchup interrupt while the stack is deep:
-- https://bugzilla.kernel.org/show_bug.cgi?id=205183
-- It is likely to be many years before that bug disappears from all
-- production kernels, so disable this test on such platforms.
-- (We still create the function, so as not to have a cross-platform
-- difference in the end state of the regression database.)

SELECT version() ~ 'powerpc64[^,]*-linux-gnu'
       AS skip_test \gset
\if :skip_test
\quit
\endif

-- The full error report is not very stable, so we show only SQLSTATE
-- and primary error message.

\set VERBOSITY sqlstate

select infinite_recurse();

\echo :LAST_ERROR_MESSAGE