31 lines
812 B
SQL
31 lines
812 B
SQL
# name: test/sql/secrets/create_secret_expression.test
|
|
# description: Test secrets with expressions as params
|
|
# group: [secrets]
|
|
|
|
require noforcestorage
|
|
|
|
statement ok
|
|
PRAGMA enable_verification;
|
|
|
|
statement ok
|
|
CREATE TABLE bearer_tokens AS SELECT 'blablab'
|
|
|
|
statement ok
|
|
SET VARIABLE my_bearer_token='hocus pocus this token is bogus';
|
|
|
|
statement ok
|
|
CREATE SECRET http (TYPE HTTP, BEARER_TOKEN getvariable('my_bearer_token'));
|
|
|
|
query I
|
|
SELECT secret_string.split(';')[-1] FROM duckdb_secrets() where name='http';
|
|
----
|
|
bearer_token=hocus pocus this token is bogus
|
|
|
|
# Test "old" syntax from before expressions were allowed
|
|
statement ok
|
|
CREATE SECRET scope_as_struct (TYPE HTTP, BEARER_TOKEN some_field, scope ('hi', 'hello'));
|
|
|
|
query I
|
|
select scope from duckdb_secrets() where name='scope_as_struct'
|
|
----
|
|
[hi, hello] |