| 
1 |  | -BEGIN;  | 
2 |  | -create extension if not exists postgis_sfcgal with schema "extensions" cascade;  | 
3 |  | -ROLLBACK;  | 
 | 1 | +begin;  | 
 | 2 | +do $_$  | 
 | 3 | +begin  | 
 | 4 | + if not exists (select 1 from pg_extension where extname = 'orioledb') then  | 
 | 5 | + -- create postgis tiger as supabase_admin  | 
 | 6 | + create extension if not exists postgis_tiger_geocoder cascade;  | 
4 | 7 | 
 
  | 
5 |  | -BEGIN;  | 
6 |  | -create extension if not exists postgis_raster with schema "extensions" cascade;  | 
7 |  | -ROLLBACK;  | 
 | 8 | + -- \ir ansible/files/postgresql_extension_custom_scripts/postgis_tiger_geocoder/after-create.sql  | 
 | 9 | + grant usage on schema tiger, tiger_data to postgres with grant option;  | 
 | 10 | + grant all privileges on all tables in schema tiger, tiger_data to postgres with grant option;  | 
 | 11 | + grant all privileges on all routines in schema tiger, tiger_data to postgres with grant option;  | 
 | 12 | + grant all privileges on all sequences in schema tiger, tiger_data to postgres with grant option;  | 
 | 13 | + alter default privileges in schema tiger, tiger_data grant all on tables to postgres with grant option;  | 
 | 14 | + alter default privileges in schema tiger, tiger_data grant all on routines to postgres with grant option;  | 
 | 15 | + alter default privileges in schema tiger, tiger_data grant all on sequences to postgres with grant option;  | 
 | 16 | + SET search_path TO extensions, public, tiger, tiger_data;  | 
 | 17 | + -- postgres role should have access  | 
 | 18 | + set local role postgres;  | 
 | 19 | + perform tiger.pprint_addy(tiger.pagc_normalize_address('710 E Ben White Blvd, Austin, TX 78704'));  | 
8 | 20 | 
 
  | 
9 |  | -BEGIN;  | 
10 |  | --- create postgis tiger as supabase_admin  | 
11 |  | -create extension if not exists address_standardizer with schema extensions;  | 
12 |  | -create extension if not exists postgis_tiger_geocoder cascade;  | 
 | 21 | + -- other roles can be granted access  | 
 | 22 | + grant usage on schema tiger, tiger_data to authenticated;  | 
 | 23 | + grant select on all tables in schema tiger, tiger_data to authenticated;  | 
 | 24 | + grant execute on all routines in schema tiger, tiger_data to authenticated;  | 
13 | 25 | 
 
  | 
14 |  | --- \ir ansible/files/postgresql_extension_custom_scripts/postgis_tiger_geocoder/after-create.sql  | 
15 |  | -grant usage on schema tiger, tiger_data to postgres with grant option;  | 
16 |  | -grant all privileges on all tables in schema tiger, tiger_data to postgres with grant option;  | 
17 |  | -grant all privileges on all routines in schema tiger, tiger_data to postgres with grant option;  | 
18 |  | -grant all privileges on all sequences in schema tiger, tiger_data to postgres with grant option;  | 
19 |  | -alter default privileges in schema tiger, tiger_data grant all on tables to postgres with grant option;  | 
20 |  | -alter default privileges in schema tiger, tiger_data grant all on routines to postgres with grant option;  | 
21 |  | -alter default privileges in schema tiger, tiger_data grant all on sequences to postgres with grant option;  | 
22 |  | -SET search_path TO extensions, public, tiger, tiger_data;  | 
23 |  | --- postgres role should have access  | 
24 |  | -set local role postgres;  | 
25 |  | -select tiger.pprint_addy(tiger.pagc_normalize_address('710 E Ben White Blvd, Austin, TX 78704'));  | 
 | 26 | + -- authenticated role should have access now  | 
 | 27 | + set local role authenticated;  | 
 | 28 | + perform tiger.pprint_addy(tiger.pagc_normalize_address('710 E Ben White Blvd, Austin, TX 78704'));  | 
 | 29 | + reset role;  | 
26 | 30 | 
 
  | 
27 |  | --- other roles can be granted access  | 
28 |  | -grant usage on schema tiger, tiger_data to authenticated;  | 
29 |  | -grant select on all tables in schema tiger, tiger_data to authenticated;  | 
30 |  | -grant execute on all routines in schema tiger, tiger_data to authenticated;  | 
31 |  | - | 
32 |  | --- authenticated role should have access now  | 
33 |  | -set local role authenticated;  | 
34 |  | -select tiger.pprint_addy(tiger.pagc_normalize_address('710 E Ben White Blvd, Austin, TX 78704'));  | 
35 |  | -ROLLBACK;  | 
36 |  | - | 
37 |  | -BEGIN;  | 
38 |  | --- address standardizer creates a table in extensions schema, owned by supabase_admin  | 
39 |  | -create extension if not exists address_standardizer_data_us with schema extensions;  | 
40 |  | --- postgres role should have access  | 
41 |  | -set local role postgres;  | 
42 |  | -select * from extensions.us_lex;  | 
43 |  | -ROLLBACK;  | 
 | 31 | + -- postgres role should have access to address_standardizer_data_us  | 
 | 32 | + set local role postgres;  | 
 | 33 | + perform 1 from us_lex;  | 
 | 34 | + reset role;  | 
 | 35 | + end if;  | 
 | 36 | +end  | 
 | 37 | +$_$;  | 
 | 38 | +rollback;  | 
0 commit comments