Created
August 17, 2017 20:08
-
-
Save begriffs/bfe21194b96f5d9c0306b55632204945 to your computer and use it in GitHub Desktop.
No error from this view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TYPE prio AS ENUM ('low', 'med', 'high'); | |
SELECT run_command_on_workers ($cmd$ | |
CREATE TYPE prio AS ENUM ('low', 'med', 'high'); | |
$cmd$); | |
CREATE TABLE todos ( | |
id serial, | |
project_id int, | |
priority prio DEFAULT 'med', | |
what text NOT NULL, | |
PRIMARY KEY (id, project_id) | |
); | |
INSERT INTO todos (project_id, what) | |
SELECT random() * 4, 'usual thing' | |
FROM generate_series(1, 100); | |
INSERT INTO todos (project_id, what, priority) | |
SELECT random() * 4, 'important thing', 'high' | |
FROM generate_series(1, 10); | |
SELECT create_distributed_table ('todos', 'project_id'); | |
CREATE VIEW important_todos AS | |
SELECT * | |
FROM todos | |
WHERE priority >= 'high'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment