Update 01936_empty_function_support_uuid.sql

This commit is contained in:
alexey-milovidov 2021-07-04 22:14:22 +03:00 committed by GitHub
parent faac204a1f
commit 3f5ef4afe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,21 +10,26 @@ FROM
SELECT toUUID('00000000-0000-0000-0000-000000000001') AS uuid SELECT toUUID('00000000-0000-0000-0000-000000000001') AS uuid
); );
CREATE DATABASE uuid_empty; DROP TABLE IF EXISTS users;
CREATE TABLE uuid_empty.users (user_id UUID) ENGINE = Memory; DROP TABLE IF EXISTS orders;
CREATE TABLE uuid_empty.orders (order_id UUID, user_id UUID) ENGINE = Memory;
INSERT INTO uuid_empty.users VALUES ('00000000-0000-0000-0000-000000000001'); CREATE TABLE users (user_id UUID) ENGINE = Memory;
INSERT INTO uuid_empty.users VALUES ('00000000-0000-0000-0000-000000000002'); CREATE TABLE orders (order_id UUID, user_id UUID) ENGINE = Memory;
INSERT INTO uuid_empty.orders VALUES ('00000000-0000-0000-0000-000000000003', '00000000-0000-0000-0000-000000000001');
INSERT INTO users VALUES ('00000000-0000-0000-0000-000000000001');
INSERT INTO users VALUES ('00000000-0000-0000-0000-000000000002');
INSERT INTO orders VALUES ('00000000-0000-0000-0000-000000000003', '00000000-0000-0000-0000-000000000001');
SELECT SELECT
uniq(user_id) AS users, uniq(user_id) AS users,
uniqIf(order_id, notEmpty(order_id)) AS orders uniqIf(order_id, notEmpty(order_id)) AS orders
FROM FROM
( (
SELECT * FROM uuid_empty.users SELECT * FROM users
) t1 ALL LEFT JOIN ( ) t1 ALL LEFT JOIN (
SELECT * FROM uuid_empty.orders SELECT * FROM orders
) t2 USING (user_id); ) t2 USING (user_id);
DROP DATABASE uuid_empty; DROP TABLE users;
DROP TABLE orders;