* check_stack_depth/stack_is_too_deep: check for excessively deep recursion * * This should be called someplace in any recursive routine that might possibly * recurse deep enough to overflow the stack. Most Unixen treat stack * overflow as an unrecoverable SIGSEGV, so we want to error out ourselves * before hitting the hardware limit. * * check_stack_depth() just throws an error summarily.
| 4459 | * can be used by code that wants to handle the error condition itself. |
| 4460 | */ |
| 4461 | void |
| 4462 | check_stack_depth(void) |
| 4463 | { |
| 4464 | if (stack_is_too_deep()) |
| 4465 | { |
| 4466 | ereport(ERROR, |
| 4467 | (errcode(ERRCODE_STATEMENT_TOO_COMPLEX), |
| 4468 | errmsg("stack depth limit exceeded"), |
| 4469 | errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), " |
| 4470 | "after ensuring the platform's stack depth limit is adequate.", |
| 4471 | max_stack_depth))); |
| 4472 | } |
| 4473 | } |
| 4474 | |
| 4475 | bool |
| 4476 | stack_is_too_deep(void) |
no test coverage detected