Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci_pr_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
test:
strategy:
matrix:
pg: [15]
pg: [13, 14, 15, 16, 17]
name: 🐘 Tests - PG ${{ matrix.pg }}
runs-on: ubuntu-latest
timeout-minutes: 30
Expand All @@ -24,9 +24,10 @@ 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' }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only run for the latest version, we should not have big differences on other versions, and it should be enough.

run: cargo clippy --color always -- --deny warnings --allow unexpected-cfgs
format:
name: 🕵️ Format
Expand Down
12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ name = "pgrx_embed_pg_no_seqscan"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg15"]
default = ["pg17"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the latest version as default, as this is the one which is closest to the future version.

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]
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"
Expand All @@ -32,4 +36,4 @@ lto = "fat"
codegen-units = 1

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pgrx_embed)'] }
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pgrx_embed)'] }
13 changes: 11 additions & 2 deletions src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ Query: {}
}

let seq_scan: &mut SeqScan = &mut *(node as *mut SeqScan);
#[cfg(not(any(feature = "pg13", feature = "pg14")))]
let table_oid = scanned_table(seq_scan.scan.scanrelid, rtables).unwrap();
#[cfg(any(feature = "pg13", feature = "pg14"))]
let table_oid = scanned_table(seq_scan.scanrelid, rtables).unwrap();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the scanrelid was accessible in a different way before pg15.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's, cool. I didn't know that you could write code for specific versions of pg with that macro.


if self.is_sequence(table_oid) {
return;
}
Expand Down Expand Up @@ -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 = "pg13", feature = "pg14")))]
CmdType::CMD_MERGE => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if !is_explain_stmt && !self.is_ignored_user(unsafe { current_username() }) {
self.check_query(&query_desc);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required when upgrading pgrx: see release notes

unsafe { hooks::init_hooks() };
guc::register_gucs();
}
Expand Down