Skip to content

Commit 79d11d1

Browse files
Upgrade to pgrx 0.9.7 (#344)
* Upgrade to pgrx 0.9.7 * Test initial-null arrays
1 parent 3545b70 commit 79d11d1

File tree

4 files changed

+90
-38
lines changed

4 files changed

+90
-38
lines changed

Cargo.lock

Lines changed: 57 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plrust-trusted-pgrx/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pg15 = ["pgrx/pg15"]
1818

1919
[dependencies]
2020
# changing the pgrx version will likely require at least a minor version bump to this create
21-
pgrx = { version = "=0.9.6", features = [ "no-schema-generation" ], default-features = false }
21+
pgrx = { version = "=0.9.7", features = [ "no-schema-generation" ], default-features = false }
2222

2323
[package.metadata.docs.rs]
2424
features = ["pg14"]

plrust/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ serde = "1.0.164"
3939
serde_json = "1.0.97"
4040

4141
# pgrx core details
42-
pgrx = { version = "=0.9.6" }
42+
pgrx = { version = "=0.9.7" }
4343

4444
# language handler support
4545
libloading = "0.8.0"
@@ -67,7 +67,7 @@ memfd = "0.6.3" # for anonymously writing/loading user function .so
6767

6868

6969
[dev-dependencies]
70-
pgrx-tests = { version = "=0.9.6" }
70+
pgrx-tests = { version = "=0.9.7" }
7171
tempdir = "0.3.7"
7272
once_cell = "1.18.0"
7373
toml = "0.7.4"

plrust/src/tests.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,36 @@ mod tests {
5454
Ok(())
5555
}
5656

57+
#[pg_test]
58+
#[search_path(@extschema@)]
59+
fn plrust_text_array_with_initial_null() -> spi::Result<()> {
60+
let definition = r#"
61+
CREATE FUNCTION collect_text_array_with_initial_null(i text[]) RETURNS text[]
62+
STRICT
63+
LANGUAGE plrust AS
64+
$$
65+
Ok(Some(i.into_iter().map(|s| s.map(|s| s.to_string())).collect()))
66+
$$;
67+
"#;
68+
Spi::run(definition)?;
69+
70+
let retval = Spi::get_one::<Vec<Option<String>>>(
71+
r#"
72+
SELECT collect_text_array_with_initial_null(ARRAY[NULL, 'a', 'b', 'c']);
73+
"#,
74+
);
75+
assert_eq!(
76+
retval,
77+
Ok(Some(vec![
78+
None,
79+
Some("a".into()),
80+
Some("b".into()),
81+
Some("c".into())
82+
]))
83+
);
84+
Ok(())
85+
}
86+
5787
#[pg_test]
5888
#[search_path(@extschema@)]
5989
fn plrust_update() -> spi::Result<()> {

0 commit comments

Comments
 (0)