ClickHouse/tests/queries/0_stateless/02883_named_collections_override.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
3.7 KiB
MySQL
Raw Normal View History

DROP NAMED COLLECTION IF EXISTS u1;
DROP NAMED COLLECTION IF EXISTS u2;
2023-11-02 14:57:57 +00:00
DROP NAMED COLLECTION IF EXISTS u3;
2023-11-02 14:57:57 +00:00
CREATE NAMED COLLECTION IF NOT EXISTS u1 AS
url = 'http://127.0.0.1:8123?query=select+1' NOT OVERRIDABLE,
format = 'RawBLOB' OVERRIDABLE;
2023-11-02 14:57:57 +00:00
CREATE NAMED COLLECTION IF NOT EXISTS u2 AS
url = 'http://127.0.0.1:8123?query=select+1',
format = 'RawBLOB';
SET allow_named_collection_override_by_default=1;
SELECT 'allow_named_collection_override_by_default=1 u1';
SELECT * FROM url(u1);
SELECT * FROM url(u1, headers('Accept'='text/csv; charset=utf-8'));
SELECT * FROM url(u1, url='http://127.0.0.1:8123?query=select+2'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(u1, format='CSV');
SELECT 'allow_named_collection_override_by_default=1 u2';
SELECT * FROM url(u2);
SELECT * FROM url(u2, headers('Accept'='text/csv; charset=utf-8'));
SELECT * FROM url(u2, url='http://127.0.0.1:8123?query=select+2');
SELECT * FROM url(u2, format='CSV');
SET allow_named_collection_override_by_default=0;
SELECT 'allow_named_collection_override_by_default=0 u1';
SELECT * FROM url(u1);
SELECT * FROM url(u1, headers('Accept'='text/csv; charset=utf-8')); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(u1, url='http://127.0.0.1:8123?query=select+2'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(u1, format='CSV');
SELECT 'allow_named_collection_override_by_default=0 u2';
SELECT * FROM url(u2);
SELECT * FROM url(u2, headers('Accept'='text/csv; charset=utf-8')); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(u2, url='http://127.0.0.1:8123?query=select+2'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(u2, format='CSV'); -- { serverError BAD_ARGUMENTS }
SELECT 'Test ALTER';
2023-11-02 14:57:57 +00:00
CREATE NAMED COLLECTION IF NOT EXISTS u3 AS
url = 'http://127.0.0.1:8123?query=select+1' NOT OVERRIDABLE,
format = 'RawBLOB' OVERRIDABLE;
ALTER NAMED COLLECTION u3 SET
url = 'http://127.0.0.1:8123?query=select+2' OVERRIDABLE,
format = 'RawBLOB' NOT OVERRIDABLE;
2023-11-02 14:57:57 +00:00
SELECT * FROM url(u3);
SELECT * FROM url(u3, url='http://127.0.0.1:8123?query=select+1');
SELECT * FROM url(u3, format='CSV'); -- { serverError BAD_ARGUMENTS }
DROP NAMED COLLECTION IF EXISTS u1;
DROP NAMED COLLECTION IF EXISTS u2;
2023-11-02 14:57:57 +00:00
DROP NAMED COLLECTION IF EXISTS u2;
SELECT 'Test XML collections';
SET allow_named_collection_override_by_default=1;
SELECT 'allow_named_collection_override_by_default=1 url_override1';
SELECT * FROM url(url_override1);
SELECT * FROM url(url_override1, headers('Accept'='text/csv; charset=utf-8'));
SELECT * FROM url(url_override1, url='http://127.0.0.1:8123?query=select+2'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(url_override1, format='CSV');
SELECT 'allow_named_collection_override_by_default=1 url_override2';
SELECT * FROM url(url_override2);
SELECT * FROM url(url_override2, headers('Accept'='text/csv; charset=utf-8'));
SELECT * FROM url(url_override2, url='http://127.0.0.1:8123?query=select+2');
SELECT * FROM url(url_override2, format='CSV');
SET allow_named_collection_override_by_default=0;
SELECT 'allow_named_collection_override_by_default=0 url_override1';
SELECT * FROM url(url_override1);
SELECT * FROM url(url_override1, headers('Accept'='text/csv; charset=utf-8')); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(url_override1, url='http://127.0.0.1:8123?query=select+2'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(url_override1, format='CSV');
SELECT 'allow_named_collection_override_by_default=0 url_override2';
SELECT * FROM url(url_override2);
SELECT * FROM url(url_override2, headers('Accept'='text/csv; charset=utf-8')); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(url_override2, url='http://127.0.0.1:8123?query=select+2'); -- { serverError BAD_ARGUMENTS }
SELECT * FROM url(url_override2, format='CSV'); -- { serverError BAD_ARGUMENTS }