Last active
November 10, 2015 23:45
-
-
Save tjstebbing/641577924fb32a7d6b4e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 100 schemas shard_001 - shard_100 | |
DO $shards$ | |
BEGIN | |
FOR i IN 1..100 LOOP | |
DECLARE shardID TEXT := CONCAT('shard_', to_char(i, 'FM000')); | |
EXECUTE 'CREATE SCHEMA IF NOT EXISTS $1 AUTHORIZATION iflix;' | |
INTO c USING shardID; | |
END LOOP; | |
END $shards$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment