1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
# 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
set allow_parser_override_extension=strict;
statement ok
CREATE SECRET a (TYPE http);
statement error
CREATE SECRET a (TYPE http);
----
Invalid Input Error: Temporary secret with name 'a' already exists!
statement ok
CREATE PERSISTENT SECRET a (TYPE http);
statement ok
CREATE PERSISTENT SECRET b (TYPE http);
statement error
CREATE PERSISTENT SECRET b (TYPE http);
----
Invalid Input Error: Persistent secret with name 'b' already exists in secret storage 'local_file'!
statement ok
CREATE OR REPLACE SECRET a (TYPE http);
statement ok
CREATE SECRET IF NOT EXISTS a (TYPE http);
statement error
CREATE OR REPLACE SECRET IF NOT EXISTS a (TYPE http);
----
Parser Error
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 sum(#1 == 'bearer_token=hocus pocus this token is bogus') FROM (SELECT unnest(secret_string.split(';')) FROM duckdb_secrets() where name='http');
----
1
# 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]
statement ok
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, SCOPE 'https://duckdb.org');
statement ok
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, SCOPE ['https://duckdb.org', 'http://extensions.duckdb.org']);
statement ok
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, BEARER_TOKEN getvariable('my_bearer_token'));
statement ok
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, HTTP_PROXY 'http://some-proxy/');
statement ok
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, VERIFY_SSL 0);
statement ok
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, VERIFY_SSL 1);
statement error
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, VERIFY_SSL something);
----
Binder Error: Failed to cast option 'verify_ssl' to type 'BOOLEAN'
statement ok
CREATE OR REPLACE SECRET my_secret (TYPE HTTP, SCOPE ['https://duckdb.org', 'http://extensions.duckdb.org'], BEARER_TOKEN getvariable('my_bearer_token'), HTTP_PROXY 'http://some-proxy/', VERIFY_SSL 1);
|