0002-Test-pg_re_throw-checking-invalid-sigjmp_buf.patch
application/octet-stream
Filename: 0002-Test-pg_re_throw-checking-invalid-sigjmp_buf.patch
Type: application/octet-stream
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0002
Subject: Test pg_re_throw checking invalid sigjmp_buf
| File | + | − |
|---|---|---|
| src/test/regress/regress.c | 31 | 0 |
| src/test/regress/sql/test_setup.sql | 5 | 0 |
From d2b53713896eb9c9a934760849ac5d2d6757fba9 Mon Sep 17 00:00:00 2001
From: wangxiaoran <fanfuxiaoran@gmail.com>
Date: Mon, 19 Aug 2024 11:49:12 +0800
Subject: [PATCH 2/2] Test pg_re_throw checking invalid sigjmp_buf
---
src/test/regress/regress.c | 31 +++++++++++++++++++++++++++++
src/test/regress/sql/test_setup.sql | 5 +++++
2 files changed, 36 insertions(+)
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index 14aad5a0c6..b7d5224c5d 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -1136,3 +1136,34 @@ binary_coercible(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(IsBinaryCoercible(srctype, targettype));
}
+
+/* Test pg_re_throw check the invalid sigjmp_buf and report error */
+static void
+wrong_pg_try()
+{
+ PG_TRY();
+ {
+ return;
+ }
+ PG_CATCH();
+ {
+ PG_RE_THROW();
+ }
+ PG_END_TRY();
+}
+
+PG_FUNCTION_INFO_V1(pg_re_throw_crash);
+Datum
+pg_re_throw_crash(PG_FUNCTION_ARGS)
+{
+ PG_TRY();
+ {
+ wrong_pg_try();
+ ereport(ERROR,(errmsg("called wrong_pg_try")));
+ }
+ PG_CATCH();
+ {
+ }
+ PG_END_TRY();
+ PG_RETURN_NULL();
+}
diff --git a/src/test/regress/sql/test_setup.sql b/src/test/regress/sql/test_setup.sql
index 06b0e2121f..24d9b5e1ac 100644
--- a/src/test/regress/sql/test_setup.sql
+++ b/src/test/regress/sql/test_setup.sql
@@ -294,3 +294,8 @@ create function fipshash(text)
returns text
strict immutable parallel safe leakproof
return substr(encode(sha256($1::bytea), 'hex'), 1, 32);
+
+create function pg_re_throw_crash()
+ RETURNS void
+ AS :'regresslib', 'pg_re_throw_crash'
+ LANGUAGE C STRICT STABLE PARALLEL SAFE;
--
2.39.3 (Apple Git-146)