Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit e9d2186

Browse files
committedMay 6, 2020
Add IF NOT EXISTS to extensions as used in multiple places
Plus 1 insert date range correction
1 parent f743117 commit e9d2186

3 files changed

+6
-4
lines changed
 

‎07_1_table_partitioning_range.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CREATE TABLE orders_y2019 PARTITION OF orders FOR VALUES FROM ('2019-01-01') TO
3434

3535
-- we keep working with the "main" table ...
3636
INSERT INTO orders
37-
SELECT 1;
37+
SELECT 1, '2019-01-01 01:00';
3838

3939
SELECT * FROM orders; -- 1 row
4040

‎07_4_table_partitioning_multi_level.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ conditions.
1919
-- when lots of sub-partitions can be forseen then it's a good idea to move them into a separate schema
2020
CREATE SCHEMA subpartitions AUTHORIZATION demorole;
2121

22+
CREATE EXTENSION IF NOT EXISTS btree_gin;
23+
2224
SET ROLE TO demorole;
2325

2426
-- used to "instantiate" separate metric definitions

‎80_advanced_indexing.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ CREATE INDEX ON main_datatypes(substring(text_data1, 1, 3));
6565
/* GIN */
6666
RESET role; -- superuser needed for creating extensions and using COPY PROGRAM
6767

68-
CREATE EXTENSION btree_gin; -- needed for indexing some "usual" datatypes like integers
68+
CREATE EXTENSION IF NOT EXISTS btree_gin; -- needed for indexing some "usual" datatypes like integers
6969
-- when we compare the B-tree and the GIN index we see that the latter is ~10x smaller
7070
CREATE INDEX ON banking.account USING gin (teller_id);
7171

@@ -83,7 +83,7 @@ CREATE INDEX ON main_datatypes USING gin (json_data jsonb_path_ops);
8383

8484
-- implementing exclusion constraints - ensure no time overlappings are possible
8585

86-
CREATE EXTENSION btree_gist;
86+
CREATE EXTENSION IF NOT EXISTS btree_gist;
8787

8888
CREATE TABLE public.room_reservation (
8989
room text,
@@ -98,7 +98,7 @@ ALTER TABLE public.room_reservation OWNER TO demorole;
9898
CREATE TABLE fuzzy_search (name text);
9999
ALTER TABLE fuzzy_search OWNER TO demorole;
100100

101-
CREATE EXTENSION pg_trgm;
101+
CREATE EXTENSION IF NOT EXISTS pg_trgm;
102102

103103
COPY fuzzy_search FROM PROGRAM 'curl www.cybertec.at/secret/orte.txt'; -- ~2k names
104104

0 commit comments

Comments
 (0)
This repository has been archived.