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

Prepare 0.9.7 #1182

Merged
merged 5 commits into from
Jun 29, 2023
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
168 changes: 91 additions & 77 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions cargo-pgrx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-pgrx"
version = "0.9.6"
version = "0.9.7"
authors = ["ZomboDB, LLC <[email protected]>"]
license = "MIT"
description = "Cargo subcommand for 'pgrx' to make Postgres extension development easy"
Expand All @@ -17,17 +17,17 @@ edition = "2021"
atty = "0.2.14"
cargo_metadata = "0.15.4"
cargo_toml = "0.15.3"
clap = { version = "4.3.5", features = [ "env", "suggestions", "cargo", "derive", "wrap_help" ] }
clap = { version = "4.3.9", features = [ "env", "suggestions", "cargo", "derive", "wrap_help" ] }
clap-cargo = { version = "0.10.0", features = [ "cargo_metadata" ] }
semver = "1.0.17"
owo-colors = { version = "3.5.0", features = [ "supports-colors" ] }
env_proxy = "0.4.1"
num_cpus = "1.15.0"
pgrx-pg-config = { path = "../pgrx-pg-config", version = "=0.9.6" }
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph", version = "=0.9.6" }
prettyplease = "0.2.8"
proc-macro2 = { version = "1.0.60", features = [ "span-locations" ] }
quote = "1.0.28"
num_cpus = "1.16.0"
pgrx-pg-config = { path = "../pgrx-pg-config", version = "=0.9.7" }
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph", version = "=0.9.7" }
prettyplease = "0.2.9"
proc-macro2 = { version = "1.0.63", features = [ "span-locations" ] }
quote = "1.0.29"
rayon = "1.7.0"
regex = "1.8.4"
ureq = "2.7.1"
Expand Down
4 changes: 2 additions & 2 deletions cargo-pgrx/src/templates/cargo_toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ]
pg_test = []

[dependencies]
pgrx = "=0.9.6"
pgrx = "=0.9.7"

[dev-dependencies]
pgrx-tests = "=0.9.6"
pgrx-tests = "=0.9.7"

[profile.dev]
panic = "unwind"
Expand Down
4 changes: 2 additions & 2 deletions nix/templates/default/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ]
pg_test = []

[dependencies]
pgrx = "=0.9.6"
pgrx = "=0.9.7"

[dev-dependencies]
pgrx-tests = "=0.9.6"
pgrx-tests = "=0.9.7"
tempfile = "3.2.0"
once_cell = "1.7.2"

Expand Down
8 changes: 4 additions & 4 deletions pgrx-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgrx-macros"
version = "0.9.6"
version = "0.9.7"
authors = ["ZomboDB, LLC <[email protected]>"]
license = "MIT"
description = "Proc Macros for 'pgrx'"
Expand All @@ -21,9 +21,9 @@ rustc-args = ["--cfg", "docsrs"]
no-schema-generation = ["pgrx-sql-entity-graph/no-schema-generation"]

[dependencies]
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph", version = "=0.9.6" }
proc-macro2 = "1.0.60"
quote = "1.0.28"
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph", version = "=0.9.7" }
proc-macro2 = "1.0.63"
quote = "1.0.29"
syn = { version = "1.0.109", features = [ "extra-traits", "full", "fold", "parsing" ] }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions pgrx-pg-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgrx-pg-config"
version = "0.9.6"
version = "0.9.7"
authors = ["ZomboDB, LLC <[email protected]>"]
license = "MIT"
description = "A Postgres pg_config wrapper for 'pgrx'"
Expand All @@ -20,6 +20,6 @@ owo-colors = "3.5.0"
serde = { version = "1.0", features = [ "derive" ] }
serde_derive = "1.0"
serde_json = "1.0"
toml = "0.7.4"
toml = "0.7.5"
url = "2.4.0"
cargo_toml = "0.15.3"
12 changes: 6 additions & 6 deletions pgrx-pg-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgrx-pg-sys"
version = "0.9.6"
version = "0.9.7"
authors = ["ZomboDB, LLC <[email protected]>"]
license = "MIT"
description = "Generated Rust bindings for Postgres internals, for use with 'pgrx'"
Expand Down Expand Up @@ -29,18 +29,18 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
memoffset = "0.9.0"
pgrx-macros = { path = "../pgrx-macros/", version = "=0.9.6" }
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph/", version = "=0.9.6" }
pgrx-macros = { path = "../pgrx-macros/", version = "=0.9.7" }
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph/", version = "=0.9.7" }
serde = { version = "1.0", features = [ "derive" ] } # impls on pub types
# polyfill until #![feature(strict_provenance)] stabilizes
sptr = "0.3"
libc = "0.2"

[build-dependencies]
bindgen = { version = "0.66.1", default-features = false, features = ["runtime"] }
pgrx-pg-config= { path = "../pgrx-pg-config/", version = "=0.9.6" }
proc-macro2 = "1.0.60"
quote = "1.0.28"
pgrx-pg-config= { path = "../pgrx-pg-config/", version = "=0.9.7" }
proc-macro2 = "1.0.63"
quote = "1.0.29"
syn = { version = "1.0.109", features = [ "extra-traits", "full", "fold", "parsing" ] }
eyre = "0.6.8"
shlex = "1.1.0" # shell lexing, also used by many of our deps
Expand Down
6 changes: 3 additions & 3 deletions pgrx-sql-entity-graph/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgrx-sql-entity-graph"
version = "0.9.6"
version = "0.9.7"
authors = ["ZomboDB, LLC <[email protected]>"]
license = "MIT"
description = "Sql Entity Graph for `pgrx`"
Expand All @@ -18,8 +18,8 @@ no-schema-generation = []
convert_case = "0.6.0"
eyre = "0.6.8"
petgraph = "0.6.3"
proc-macro2 = { version = "1.0.60", features = [ "span-locations" ] }
quote = "1.0.28"
proc-macro2 = { version = "1.0.63", features = [ "span-locations" ] }
quote = "1.0.29"
syn = { version = "1.0.109", features = [ "extra-traits", "full", "fold", "parsing" ] }
unescape = "0.1.0"

Expand Down
10 changes: 5 additions & 5 deletions pgrx-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgrx-tests"
version = "0.9.6"
version = "0.9.7"
authors = ["ZomboDB, LLC <[email protected]>"]
license = "MIT"
description = "Test framework for 'pgrx'-based Postgres extensions"
Expand Down Expand Up @@ -36,9 +36,9 @@ rustdoc-args = ["--cfg", "docsrs"]
clap-cargo = "0.10.0"
owo-colors = "3.5.0"
once_cell = "1.18.0"
libc = "0.2.146"
pgrx-macros = { path = "../pgrx-macros", version = "=0.9.6" }
pgrx-pg-config = { path = "../pgrx-pg-config", version = "=0.9.6" }
libc = "0.2.147"
pgrx-macros = { path = "../pgrx-macros", version = "=0.9.7" }
pgrx-pg-config = { path = "../pgrx-pg-config", version = "=0.9.7" }
postgres = "0.19.5"
regex = "1.8.4"
serde = "1.0"
Expand All @@ -53,4 +53,4 @@ eyre = "0.6.8" # testing functions that return `eyre::Result`
[dependencies.pgrx]
path = "../pgrx"
default-features = false
version = "=0.9.6"
version = "=0.9.7"
48 changes: 48 additions & 0 deletions pgrx-tests/src/tests/array_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,52 @@ mod tests {
}
Ok(())
}

#[pg_test]
fn test_text_array_as_vec_string() -> Result<(), Box<dyn std::error::Error>> {
let a = Spi::get_one::<Array<String>>(
"SELECT ARRAY[NULL, NULL, NULL, NULL, 'the fifth element']::text[]",
)?
.expect("spi result was NULL")
.into_iter()
.collect::<Vec<_>>();
assert_eq!(a, vec![None, None, None, None, Some(String::from("the fifth element"))]);
Ok(())
}

#[pg_test]
fn test_text_array_iter() -> Result<(), Box<dyn std::error::Error>> {
let a = Spi::get_one::<Array<String>>(
"SELECT ARRAY[NULL, NULL, NULL, NULL, 'the fifth element']::text[]",
)?
.expect("spi result was NULL");

let mut iter = a.iter();

assert_eq!(iter.next(), Some(None));
assert_eq!(iter.next(), Some(None));
assert_eq!(iter.next(), Some(None));
assert_eq!(iter.next(), Some(None));
assert_eq!(iter.next(), Some(Some(String::from("the fifth element"))));
assert_eq!(iter.next(), None);

Ok(())
}

#[pg_test]
fn test_text_array_via_getter() -> Result<(), Box<dyn std::error::Error>> {
let a = Spi::get_one::<Array<String>>(
"SELECT ARRAY[NULL, NULL, NULL, NULL, 'the fifth element']::text[]",
)?
.expect("spi result was NULL");

assert_eq!(a.get(0), Some(None));
assert_eq!(a.get(1), Some(None));
assert_eq!(a.get(2), Some(None));
assert_eq!(a.get(3), Some(None));
assert_eq!(a.get(4), Some(Some(String::from("the fifth element"))));
assert_eq!(a.get(5), None);

Ok(())
}
}
4 changes: 2 additions & 2 deletions pgrx-version-updater/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT"
description = "Standalone tool to update PGRX Cargo.toml versions and dependencies in preparation for a release."

[dependencies]
clap = { version = "4.3.5", features = [ "env", "derive" ] }
clap = { version = "4.3.9", features = [ "env", "derive" ] }
owo-colors = "3.5.0"
toml_edit = { version = "0.19.10" }
toml_edit = { version = "0.19.11" }
walkdir = "2"
14 changes: 7 additions & 7 deletions pgrx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgrx"
version = "0.9.6"
version = "0.9.7"
authors = ["ZomboDB, LLC <[email protected]>"]
license = "MIT"
description = "pgrx: A Rust framework for creating Postgres extensions"
Expand Down Expand Up @@ -33,25 +33,25 @@ no-default-features = true
rustc-args = ["--cfg", "docsrs"]

[dependencies]
pgrx-macros = { path = "../pgrx-macros", version = "=0.9.6" }
pgrx-pg-sys = { path = "../pgrx-pg-sys", version = "=0.9.6" }
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph", version = "=0.9.6" }
pgrx-macros = { path = "../pgrx-macros", version = "=0.9.7" }
pgrx-pg-sys = { path = "../pgrx-pg-sys", version = "=0.9.7" }
pgrx-sql-entity-graph = { path = "../pgrx-sql-entity-graph", version = "=0.9.7" }

# used to internally impl things
once_cell = "1.18.0" # polyfill until std::lazy::OnceCell stabilizes
seq-macro = "0.3" # impls loops in macros
uuid = { version = "1.3.4", features = [ "v4" ] } # PgLwLock and shmem
uuid = { version = "1.4.0", features = [ "v4" ] } # PgLwLock and shmem
enum-map = "2.5.0"

# error handling and logging
thiserror = "1.0"

# exposed in public API
atomic-traits = "0.3.0" # PgAtomic and shmem init
bitflags = "2.3.2" # BackgroundWorker
bitflags = "2.3.3" # BackgroundWorker
bitvec = "1.0" # processing array nullbitmaps
heapless = "0.7.16" # shmem and PgLwLock
libc = "0.2.146" # FFI type compat
libc = "0.2.147" # FFI type compat
seahash = "4.1.0" # derive(PostgresHash)
serde = { version = "1.0", features = [ "derive" ] } # impls on pub types
serde_cbor = "0.11.2" # derive(PostgresType)
Expand Down
16 changes: 12 additions & 4 deletions pgrx/src/datum/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,13 @@ impl<'a, T: FromDatum> Iterator for ArrayIterator<'a, T> {
fn next(&mut self) -> Option<Self::Item> {
let Self { array, curr, ptr } = self;
let Some(is_null) = array.null_slice.get(*curr) else { return None };
let element = unsafe { array.bring_it_back_now(*ptr, is_null) };
*curr += 1;
if let Some(false) = array.null_slice.get(*curr) {

let element = unsafe { array.bring_it_back_now(*ptr, is_null) };
if !is_null {
// SAFETY: This has to not move for nulls, as they occupy 0 data bytes,
// and it has to move only after unpacking a non-null varlena element,
// as the iterator starts by pointing to the first non-null element!
*ptr = unsafe { array.one_hop_this_time(*ptr) };
}
Some(element)
Expand Down Expand Up @@ -679,9 +683,13 @@ impl<'a, T: FromDatum> Iterator for ArrayIntoIterator<'a, T> {
fn next(&mut self) -> Option<Self::Item> {
let Self { array, curr, ptr } = self;
let Some(is_null) = array.null_slice.get(*curr) else { return None };
let element = unsafe { array.bring_it_back_now(*ptr, is_null) };
*curr += 1;
if let Some(false) = array.null_slice.get(*curr) {

let element = unsafe { array.bring_it_back_now(*ptr, is_null) };
if !is_null {
// SAFETY: This has to not move for nulls, as they occupy 0 data bytes,
// and it has to move only after unpacking a non-null varlena element,
// as the iterator starts by pointing to the first non-null element!
*ptr = unsafe { array.one_hop_this_time(*ptr) };
}
Some(element)
Expand Down