From 349a2f92bc17bc7dad80b668395aa55335e38871 Mon Sep 17 00:00:00 2001 From: Emmanuel Quincerot Date: Sat, 7 Jun 2025 14:20:07 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Support=20up=20to=20pg17=20=F0=9F=A5=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci_pr_tests.yml | 3 ++- Cargo.toml | 7 ++++++- src/hooks.rs | 13 +++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_pr_tests.yml b/.github/workflows/ci_pr_tests.yml index 8b8484a..7d1505d 100644 --- a/.github/workflows/ci_pr_tests.yml +++ b/.github/workflows/ci_pr_tests.yml @@ -14,7 +14,7 @@ jobs: test: strategy: matrix: - pg: [15] + pg: [12, 13, 14, 15, 16, 17] name: ๐Ÿ˜ Tests - PG ${{ matrix.pg }} runs-on: ubuntu-latest timeout-minutes: 30 @@ -27,6 +27,7 @@ jobs: - name: ๐Ÿงช Test on PG ${{ matrix.pg }} run: pgrx-build-test - name: ๐Ÿ“Ž Clippy - PG ${{ matrix.pg }} + if: ${{ matrix.pg == '15' }} run: cargo clippy --color always -- --deny warnings --allow unexpected-cfgs format: name: ๐Ÿ•ต๏ธ Format diff --git a/Cargo.toml b/Cargo.toml index 17099a6..b9196ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,12 @@ path = "./src/bin/pgrx_embed.rs" [features] default = ["pg15"] +pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ] +pg13 = ["pgrx/pg13", "pgrx-tests/pg13" ] +pg14 = ["pgrx/pg14", "pgrx-tests/pg14" ] pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ] +pg16 = ["pgrx/pg16", "pgrx-tests/pg16" ] +pg17 = ["pgrx/pg17", "pgrx-tests/pg17" ] pg_test = [] [dependencies] @@ -32,4 +37,4 @@ lto = "fat" codegen-units = 1 [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pgrx_embed)'] } \ No newline at end of file +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pgrx_embed)'] } diff --git a/src/hooks.rs b/src/hooks.rs index 88c955d..ec73abe 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -139,7 +139,11 @@ Query: {} } let seq_scan: &mut SeqScan = &mut *(node as *mut SeqScan); + #[cfg(not(any(feature = "pg12", feature = "pg13", feature = "pg14")))] let table_oid = scanned_table(seq_scan.scan.scanrelid, rtables).unwrap(); + #[cfg(any(feature = "pg12", feature = "pg13", feature = "pg14"))] + let table_oid = scanned_table(seq_scan.scanrelid, rtables).unwrap(); + if self.is_sequence(table_oid) { return; } @@ -244,8 +248,13 @@ impl PgHooks for NoSeqscanHooks { CmdType::CMD_SELECT | CmdType::CMD_UPDATE | CmdType::CMD_INSERT - | CmdType::CMD_DELETE - | CmdType::CMD_MERGE => { + | CmdType::CMD_DELETE => { + if !is_explain_stmt && !self.is_ignored_user(unsafe { current_username() }) { + self.check_query(&query_desc); + } + } + #[cfg(not(any(feature = "pg12", feature = "pg13", feature = "pg14")))] + CmdType::CMD_MERGE => { if !is_explain_stmt && !self.is_ignored_user(unsafe { current_username() }) { self.check_query(&query_desc); } From 57fd9630a054a061a6bf0981eaaa7f8d32015331 Mon Sep 17 00:00:00 2001 From: Emmanuel Quincerot Date: Sat, 7 Jun 2025 19:26:09 +0200 Subject: [PATCH 2/3] Support live pg version + upgrade pgrx --- .github/workflows/ci_pr_tests.yml | 4 ++-- Cargo.toml | 7 +++---- src/hooks.rs | 6 +++--- src/lib.rs | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci_pr_tests.yml b/.github/workflows/ci_pr_tests.yml index 7d1505d..39fe1cb 100644 --- a/.github/workflows/ci_pr_tests.yml +++ b/.github/workflows/ci_pr_tests.yml @@ -14,7 +14,7 @@ jobs: test: strategy: matrix: - pg: [12, 13, 14, 15, 16, 17] + pg: [13, 14, 15, 16, 17] name: ๐Ÿ˜ Tests - PG ${{ matrix.pg }} runs-on: ubuntu-latest timeout-minutes: 30 @@ -27,7 +27,7 @@ jobs: - name: ๐Ÿงช Test on PG ${{ matrix.pg }} run: pgrx-build-test - name: ๐Ÿ“Ž Clippy - PG ${{ matrix.pg }} - if: ${{ matrix.pg == '15' }} + if: ${{ matrix.pg == '17' }} run: cargo clippy --color always -- --deny warnings --allow unexpected-cfgs format: name: ๐Ÿ•ต๏ธ Format diff --git a/Cargo.toml b/Cargo.toml index b9196ab..1a3507f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,7 @@ name = "pgrx_embed_pg_no_seqscan" path = "./src/bin/pgrx_embed.rs" [features] -default = ["pg15"] -pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ] +default = ["pg17"] pg13 = ["pgrx/pg13", "pgrx-tests/pg13" ] pg14 = ["pgrx/pg14", "pgrx-tests/pg14" ] pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ] @@ -21,11 +20,11 @@ pg17 = ["pgrx/pg17", "pgrx-tests/pg17" ] pg_test = [] [dependencies] -pgrx = "=0.12.9" +pgrx = "=0.14.3" regex = "1.11.1" [dev-dependencies] -pgrx-tests = "=0.12.9" +pgrx-tests = "=0.14.3" [profile.dev] panic = "unwind" diff --git a/src/hooks.rs b/src/hooks.rs index ec73abe..c949da6 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -139,9 +139,9 @@ Query: {} } let seq_scan: &mut SeqScan = &mut *(node as *mut SeqScan); - #[cfg(not(any(feature = "pg12", feature = "pg13", feature = "pg14")))] + #[cfg(not(any(feature = "pg13", feature = "pg14")))] let table_oid = scanned_table(seq_scan.scan.scanrelid, rtables).unwrap(); - #[cfg(any(feature = "pg12", feature = "pg13", feature = "pg14"))] + #[cfg(any(feature = "pg13", feature = "pg14"))] let table_oid = scanned_table(seq_scan.scanrelid, rtables).unwrap(); if self.is_sequence(table_oid) { @@ -253,7 +253,7 @@ impl PgHooks for NoSeqscanHooks { self.check_query(&query_desc); } } - #[cfg(not(any(feature = "pg12", feature = "pg13", feature = "pg14")))] + #[cfg(not(any(feature = "pg13", feature = "pg14")))] CmdType::CMD_MERGE => { if !is_explain_stmt && !self.is_ignored_user(unsafe { current_username() }) { self.check_query(&query_desc); diff --git a/src/lib.rs b/src/lib.rs index a6faa11..343cd48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ use pgrx::prelude::*; ::pgrx::pg_module_magic!(); #[pg_guard] -pub extern "C" fn _PG_init() { +pub extern "C-unwind" fn _PG_init() { unsafe { hooks::init_hooks() }; guc::register_gucs(); } From 63a2ffb82770de16dc8e837e9d83f4163e94bef0 Mon Sep 17 00:00:00 2001 From: Emmanuel Quincerot Date: Sat, 7 Jun 2025 19:28:18 +0200 Subject: [PATCH 3/3] GH - Homogeneous step names --- .github/workflows/ci_pr_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_pr_tests.yml b/.github/workflows/ci_pr_tests.yml index 39fe1cb..062dd5b 100644 --- a/.github/workflows/ci_pr_tests.yml +++ b/.github/workflows/ci_pr_tests.yml @@ -24,7 +24,7 @@ jobs: run: pg-start ${{ matrix.pg }} - name: Check out the repo - PG ${{ matrix.pg }} uses: actions/checkout@v4 - - name: ๐Ÿงช Test on PG ${{ matrix.pg }} + - name: ๐Ÿงช Test - PG ${{ matrix.pg }} run: pgrx-build-test - name: ๐Ÿ“Ž Clippy - PG ${{ matrix.pg }} if: ${{ matrix.pg == '17' }}