Open
Description
e.g.
CREATE OR REPLACE FUNCTION plrust.random_slogan() RETURNS TEXT
LANGUAGE plrust AS $$
[dependencies]
faker_rand = "0.1"
rand = "0.8"
[code]
use faker_rand::en_us::company::Slogan;
Ok(Some(rand::random::<Slogan>().to_string()))
$$;
SELECT plrust.random_slogan();
reportedly yields
CREATE FUNCTION
ERROR: cannot sample empty range
which hits an assert here:
fn gen_range<T, R>(&mut self, range: R) -> T
where
T: SampleUniform,
R: SampleRange<T>
{
assert!(!range.is_empty(), "cannot sample empty range");
range.sample_single(self).unwrap()
}
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
gaslitbytech commentedon Sep 10, 2023
I created a test in
plrust-tests/src/dependencies.rs
that I wanted to use to reproduce the issue.Though I did get:
0: `faker_rand` is not an allowed dependency
New Test:
Full Error:
Is this related to trusted / untrusted mode?
workingjubilee commentedon Sep 10, 2023
The tests are set up with an allowed dependencies file here:
plrust/plrust-tests/src/lib.rs
Lines 71 to 77 in 3725747
gaslitbytech commentedon Sep 10, 2023
Thanks. Interesting that the test still passes.
So I changed
To
And now I get:
So this means that this example does work in the unit tests. Just not when I launch using
Dockerfile.try
workingjubilee commentedon Sep 10, 2023
That's weird.