Introduce a function to list all the allowed dependencies and their respective versions and features.
E.g Given a toml like this,
$ > cat ~/allow.toml
owo-colors = "=3.5.0"
tokio = { version = "=1.19.2", features = ["rt", "net"] }
plutonium = "*"
syn = { version = "=2.0.28", default-features = false }
rand = ["=0.8.3", { version = ">0.8.4, <0.8.6", features = ["getrandom"] }]
the function returns a table
postgres=# SELECT * FROM plrust.list_allowed_dependencies();
name | version | features | default_features
------------+----------------+-------------+------------------
owo-colors | =3.5.0 | {} | t
plutonium | * | {} | t
rand | =0.8.3 | {} | t
rand | >0.8.4, <0.8.6 | {getrandom} | t
syn | =2.0.28 | {} | f
tokio | =1.19.2 | {rt,net} | t
(6 rows)
This commit also bumps plrust to 1.1 and introduce the sql script for schema upgrade
Testing
Unit test passed
Tested extension upgrade
Install plrust 1.0 (v1.2.3)
postgres=# CREATE EXTENSION plrust ;
CREATE EXTENSION
postgres=# \dx plrust
List of installed extensions
-[ RECORD 1 ]-----------------------------------------------------------
Name | plrust
Version | 1.0
Schema | plrust
Description | plrust: A Trusted Rust procedural language for PostgreSQL
postgres=# \df plrust.*
List of functions
-[ RECORD 1 ]-------+--------------------
Schema | plrust
Name | plrust_call_handler
Result data type | language_handler
Argument data types |
Type | func
-[ RECORD 2 ]-------+--------------------
Schema | plrust
Name | plrust_validator
Result data type | void
Argument data types | fn_oid oid
Type | func
2. Update plrust to 1.1, new function is installed
postgres=# ALTER EXTENSION plrust UPDATE TO '1.1';
ALTER EXTENSION
postgres=# \dx plrust
List of installed extensions
-[ RECORD 1 ]-----------------------------------------------------------
Name | plrust
Version | 1.1
Schema | plrust
Description | plrust: A Trusted Rust procedural language for PostgreSQL
postgres=# \df plrust.*
List of functions
-[ RECORD 1 ]-------+--------------------------------------------------------------------------
Schema | plrust
Name | list_allowed_dependencies
Result data type | TABLE(name text, version text, features text[], default_features boolean)
Argument data types |
Type | func
-[ RECORD 2 ]-------+--------------------------------------------------------------------------
Schema | plrust
Name | plrust_call_handler
Result data type | language_handler
Argument data types |
Type | func
-[ RECORD 3 ]-------+--------------------------------------------------------------------------
Schema | plrust
Name | plrust_validator
Result data type | void
Argument data types | fn_oid oid
Type | func
postgres=# SELECT FROM plrust.list_allowed_dependencies();
name | version | features | default_features
------------+----------------+-------------+------------------
owo-colors | =3.5.0 | {} | t
plutonium | | {} | t
rand | =0.8.3 | {} | t
rand | >0.8.4, <0.8.6 | {getrandom} | t
syn | =2.0.28 | {} | f
tokio | =1.19.2 | {rt,net} | t
(6 rows)
This commit addresses issue #371
Introduce a function to list all the allowed dependencies and their respective versions and features.
E.g Given a toml like this,
the function returns a table
This commit also bumps plrust to 1.1 and introduce the sql script for schema upgrade
Testing
postgres=# \df plrust.* List of functions -[ RECORD 1 ]-------+-------------------- Schema | plrust Name | plrust_call_handler Result data type | language_handler Argument data types | Type | func -[ RECORD 2 ]-------+-------------------- Schema | plrust Name | plrust_validator Result data type | void Argument data types | fn_oid oid Type | func
postgres=# ALTER EXTENSION plrust UPDATE TO '1.1'; ALTER EXTENSION postgres=# \dx plrust List of installed extensions -[ RECORD 1 ]----------------------------------------------------------- Name | plrust Version | 1.1 Schema | plrust Description | plrust: A Trusted Rust procedural language for PostgreSQL
postgres=# \df plrust.* List of functions -[ RECORD 1 ]-------+-------------------------------------------------------------------------- Schema | plrust Name | list_allowed_dependencies Result data type | TABLE(name text, version text, features text[], default_features boolean) Argument data types | Type | func -[ RECORD 2 ]-------+-------------------------------------------------------------------------- Schema | plrust Name | plrust_call_handler Result data type | language_handler Argument data types | Type | func -[ RECORD 3 ]-------+-------------------------------------------------------------------------- Schema | plrust Name | plrust_validator Result data type | void Argument data types | fn_oid oid Type | func
postgres=# SELECT FROM plrust.list_allowed_dependencies(); name | version | features | default_features ------------+----------------+-------------+------------------ owo-colors | =3.5.0 | {} | t plutonium | | {} | t rand | =0.8.3 | {} | t rand | >0.8.4, <0.8.6 | {getrandom} | t syn | =2.0.28 | {} | f tokio | =1.19.2 | {rt,net} | t (6 rows)