-
Notifications
You must be signed in to change notification settings - Fork 0
chore: support officially maintained pg versions (13 to 17) #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,16 +11,20 @@ name = "pgrx_embed_pg_no_seqscan" | |
| path = "./src/bin/pgrx_embed.rs" | ||
|
|
||
| [features] | ||
| default = ["pg15"] | ||
| default = ["pg17"] | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
|
|
@@ -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)'] } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems the scanrelid was accessible in a different way before pg15.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
| } | ||
|
|
@@ -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 => { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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() { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
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.