Skip to content

Commit 3eee28c

Browse files
committed
explicitly require pg_parquet in shared_preload_libraries
1 parent 8cec92c commit 3eee28c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,23 @@ After installing `Postgres`, you need to set up `rustup`, `cargo-pgrx` to build
3636
# install rustup
3737
> curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
3838

39+
# set cargo-pgrx (should be the same as pgrx dep in Cargo.toml) and pg versions
40+
> export CARGO_PGRX_VERSION=0.15.0
41+
> export PG_MAJOR=17
42+
3943
# install cargo-pgrx
40-
> cargo install cargo-pgrx
44+
> cargo install --force --locked cargo-pgrx@"${CARGO_PGRX_VERSION}"
4145

4246
# configure pgrx
43-
> cargo pgrx init --pg17 $(which pg_config)
47+
> cargo pgrx init --pg"${PG_MAJOR}" $(which pg_config)
4448

45-
# append the extension to shared_preload_libraries in ~/.pgrx/data-17/postgresql.conf
46-
> echo "shared_preload_libraries = 'pg_parquet'" >> ~/.pgrx/data-17/postgresql.conf
49+
# append the extension to shared_preload_libraries
50+
> echo "shared_preload_libraries = 'pg_parquet'" >> ~/.pgrx/data-"${PG_MAJOR}"/postgresql.conf
4751

4852
# initialize a data directory, build and install the extension (to the targets specified by configured pg_config), then connects to a session
49-
> cargo pgrx run
53+
> cargo pgrx run --features pg"${PG_MAJOR}"
5054
# alternatively you can only build and install the extension (pass --release flag for production binary)
51-
> cargo pgrx install --release
55+
> cargo pgrx install --release --features pg"${PG_MAJOR}"
5256

5357
# create the extension in the database
5458
psql> "CREATE EXTENSION pg_parquet;"

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ pub(crate) static PG_BACKEND_TOKIO_RUNTIME: LazyLock<Runtime> = LazyLock::new(||
3737

3838
#[pg_guard]
3939
pub extern "C-unwind" fn _PG_init() {
40+
if !unsafe { pgrx::pg_sys::process_shared_preload_libraries_in_progress } {
41+
panic!("pg_parquet must be loaded via shared_preload_libraries. Add 'pg_parquet' to shared_preload_libraries in postgresql.conf and restart Postgres.");
42+
}
43+
4044
unsafe {
4145
GucRegistry::define_bool_guc(
4246
CStr::from_ptr("pg_parquet.enable_copy_hooks".as_pg_cstr()),

0 commit comments

Comments
 (0)