Skip to content
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

chore: Bump pgrx to 0.12.1 #100

Merged
merged 3 commits into from
Aug 25, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/benchmark-pg_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

- name: Install pgrx & pg_analytics
run: |
cargo install -j $(nproc) --locked cargo-pgrx --version 0.11.3
cargo install -j $(nproc) --locked cargo-pgrx --version 0.12.1
cargo pgrx init --pg${{ matrix.pg_version }}=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config
cargo pgrx install --pg-config="/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config" --release

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
sudo apt-get update && sudo apt-get install -y postgresql-${{ matrix.pg_version }} postgresql-server-dev-${{ matrix.pg_version }}

- name: Install pgrx
run: cargo install --locked cargo-pgrx --version 0.11.3
run: cargo install --locked cargo-pgrx --version 0.12.1

- name: Initialize pgrx for Current PostgreSQL Version
run: cargo pgrx init --pg${{ matrix.pg_version }}=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pg_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ jobs:
sudo dnf install -y postgresql${{ matrix.pg_version }} postgresql${{ matrix.pg_version }}-server postgresql${{ matrix.pg_version }}-devel

- name: Install pgrx
run: cargo install -j $(nproc) --locked cargo-pgrx --version 0.11.3
run: cargo install -j $(nproc) --locked cargo-pgrx --version 0.12.1

# Note: We need to specify bash as the shell to ensure that it doesn't default to /bin/sh on Debian, which doesn't support the `[[` syntax
- name: Initialize pgrx for Current PostgreSQL Version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pg_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Install pgrx & llvm-tools-preview
if: steps.check_skip.outputs.skip_remaining_steps != 'true'
run: |
cargo install -j $(nproc) --locked cargo-pgrx --version 0.11.3
cargo install -j $(nproc) --locked cargo-pgrx --version 0.12.1
rustup component add llvm-tools-preview
cargo pgrx init "--pg${{ matrix.pg_version }}=/usr/lib/postgresql/${{ matrix.pg_version }}/bin/pg_config"

Expand Down
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ duckdb = { git = "https://github.com/paradedb/duckdb-rs.git", features = [
"bundled",
"extensions-full",
], rev = "e532dd6" }
pgrx = "0.11.3"
pgrx = "0.12.1"
serde = "1.0.201"
serde_json = "1.0.120"
signal-hook = "0.3.17"
signal-hook-async-std = "0.2.2"
strum = { version = "0.26.3", features = ["derive"] }
supabase-wrappers = { git = "https://github.com/paradedb/wrappers.git", default-features = false, rev = "27af09b" }
supabase-wrappers = { git = "https://github.com/paradedb/wrappers.git", default-features = false, rev = "c6f5e79" }
thiserror = "1.0.59"
uuid = "1.9.1"

Expand All @@ -44,7 +44,7 @@ bytes = "1.7.1"
datafusion = "37.1.0"
deltalake = { version = "0.17.3", features = ["datafusion"] }
futures = "0.3.30"
pgrx-tests = "0.11.3"
pgrx-tests = "0.12.1"
rstest = "0.19.0"
serde_arrow = { version = "0.11.3", features = ["arrow-51"] }
soa_derive = "0.13.0"
Expand All @@ -60,3 +60,7 @@ tempfile = "3.12.0"
testcontainers = "0.16.7"
testcontainers-modules = { version = "0.4.2", features = ["localstack"] }
time = { version = "0.3.34", features = ["serde"] }

[[bin]]
name = "pgrx_embed_pg_analytics"
path = "src/bin/pgrx_embed.rs"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Then, install and initialize `pgrx`:

```bash
# Note: Replace --pg16 with your version of Postgres, if different (i.e. --pg15, --pg14, etc.)
cargo install --locked cargo-pgrx --version 0.11.3
cargo install --locked cargo-pgrx --version 0.12.1

# macOS arm64
cargo pgrx init --pg16=/opt/homebrew/opt/postgresql@16/bin/pg_config
Expand Down
2 changes: 1 addition & 1 deletion src/api/time_bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use pgrx::*;
use pgrx::{datum::*, pg_extern};

const TIME_BUCKET_FALLBACK_ERROR: &str = "Function `time_bucket()` must be used with a DuckDB FDW. Native postgres does not support this function. If you believe this function should be implemented natively as a fallback please submit a ticket to https://github.com/paradedb/pg_analytics/issues.";

Expand Down
1 change: 1 addition & 0 deletions src/bin/pgrx_embed.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::pgrx::pgrx_embed!();
2 changes: 1 addition & 1 deletion src/fdw/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl From<*mut pg_sys::ForeignServer> for FdwHandler {
let handler_oid = unsafe { (*fdw).fdwhandler };
let proc_tuple = unsafe {
pg_sys::SearchSysCache1(
pg_sys::SysCacheIdentifier_PROCOID as i32,
pg_sys::SysCacheIdentifier::PROCOID as i32,
handler_oid.into_datum().unwrap(),
)
};
Expand Down
7 changes: 4 additions & 3 deletions src/hooks/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ macro_rules! fallback_warning {
};
}

#[allow(deprecated)]
pub async fn executor_run(
query_desc: PgBox<pg_sys::QueryDesc>,
direction: pg_sys::ScanDirection,
direction: pg_sys::ScanDirection::Type,
count: u64,
execute_once: bool,
prev_hook: fn(
query_desc: PgBox<pg_sys::QueryDesc>,
direction: pg_sys::ScanDirection,
direction: pg_sys::ScanDirection::Type,
count: u64,
execute_once: bool,
) -> HookResult<()>,
Expand All @@ -61,7 +62,7 @@ pub async fn executor_run(
});

if rtable.is_null()
|| query_desc.operation != pg_sys::CmdType_CMD_SELECT
|| query_desc.operation != pg_sys::CmdType::CMD_SELECT
|| !is_duckdb_query
// Tech Debt: Find a less hacky way to let COPY/CREATE go through
|| query.to_lowercase().starts_with("copy")
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ use pgrx::*;

pub struct ExtensionHook;

#[allow(deprecated)]
impl hooks::PgHooks for ExtensionHook {
fn executor_run(
&mut self,
query_desc: PgBox<pg_sys::QueryDesc>,
direction: pg_sys::ScanDirection,
direction: pg_sys::ScanDirection::Type,
count: u64,
execute_once: bool,
prev_hook: fn(
query_desc: PgBox<pg_sys::QueryDesc>,
direction: pg_sys::ScanDirection,
direction: pg_sys::ScanDirection::Type,
count: u64,
execute_once: bool,
) -> HookResult<()>,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn get_query_relations(planned_stmt: *mut pg_sys::PlannedStmt) -> Vec<PgRela
rte = (*elements.offset(i as isize)).ptr_value as *mut pg_sys::RangeTblEntry;
}

if (*rte).rtekind != pg_sys::RTEKind_RTE_RELATION {
if (*rte).rtekind != pg_sys::RTEKind::RTE_RELATION {
continue;
}
let relation = pg_sys::RelationIdGetRelation((*rte).relid);
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static mut EXTENSION_HOOK: ExtensionHook = ExtensionHook;
#[pg_guard]
pub extern "C" fn _PG_init() {
#[allow(static_mut_refs)]
#[allow(deprecated)]
unsafe {
register_hook(&mut EXTENSION_HOOK)
};
Expand Down