From ef376fd243355416419f309a727eb0b04a14781d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Mart=C3=ADnez?= Date: Wed, 4 Nov 2015 17:06:54 +0100 Subject: [PATCH 1/6] Remove schema_triggers --- README.md | 9 -- cartodb.control.in | 2 +- expected/test_setup.out | 1 - scripts-available/CDB_DDLTriggers.sql | 214 -------------------------- sql/test_setup.sql | 3 +- 5 files changed, 2 insertions(+), 227 deletions(-) delete mode 100644 scripts-available/CDB_DDLTriggers.sql diff --git a/README.md b/README.md index ec166ca..f9c0011 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,6 @@ Dependencies * PostgreSQL 9.3+ (with plpythonu extension and xml support) * [PostGIS extension](http://postgis.net) - * [Schema triggers extension] - (https://bitbucket.org/malloclabs/pg_schema_triggers) - (or [fork](https://github.com/CartoDB/pg_schema_triggers)) Install ------- @@ -31,10 +28,6 @@ Test installation make installcheck ``` -NOTE: if ``test_ddl_triggers`` fails it's likely due to an incomplete - installation of schema_triggers: you need to add ``schema_triggers.so`` - to the ``shared_preload_libraries`` setting in postgresql.conf ! - NOTE: you need to run the installcheck as a superuser, use PGUSER env variable if needed, like: PGUSER=postgres make installcheck @@ -47,7 +40,6 @@ In a database that needs to be turned into a "cartodb" user database, run: ```sql CREATE EXTENSION postgis; -CREATE EXTENSION schema_triggers; CREATE EXTENSION cartodb; ``` @@ -63,7 +55,6 @@ be in the "cartodb" schema. ```sql CREATE EXTENSION postgis FROM unpackaged; -CREATE EXTENSION schema_triggers; CREATE EXTENSION cartodb FROM unpackaged; ``` diff --git a/cartodb.control.in b/cartodb.control.in index c331343..a5dcfa0 100644 --- a/cartodb.control.in +++ b/cartodb.control.in @@ -3,4 +3,4 @@ comment = 'Turn a database into a cartodb user database.' superuser = true relocatable = false schema = cartodb -requires = 'plpythonu, schema_triggers, postgis' +requires = 'plpythonu, postgis' diff --git a/expected/test_setup.out b/expected/test_setup.out index c05769f..cb4d895 100644 --- a/expected/test_setup.out +++ b/expected/test_setup.out @@ -1,5 +1,4 @@ CREATE EXTENSION postgis; -CREATE EXTENSION schema_triggers; CREATE EXTENSION plpythonu; CREATE EXTENSION cartodb; CREATE FUNCTION public.cdb_invalidate_varnish(table_name text) diff --git a/scripts-available/CDB_DDLTriggers.sql b/scripts-available/CDB_DDLTriggers.sql deleted file mode 100644 index dddd60e..0000000 --- a/scripts-available/CDB_DDLTriggers.sql +++ /dev/null @@ -1,214 +0,0 @@ --- Table creation --- { -CREATE OR REPLACE FUNCTION cartodb.cdb_handle_create_table () -RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $$ -DECLARE - event_info RECORD; - rel RECORD; - newtable REGCLASS; -BEGIN - event_info := schema_triggers.get_relation_create_eventinfo(); - - -- We're only interested in real relations - IF (event_info.new).relkind != 'r' THEN RETURN; END IF; - - SELECT c.relname, c.relnamespace, c.relkind, n.nspname - FROM pg_class c - JOIN pg_namespace n - ON c.relnamespace = n.oid - WHERE c.oid = event_info.relation - INTO rel; - - RAISE DEBUG 'Relation % of kind % created in table % namespace % (oid %)', - event_info.relation, rel.relkind, rel.relname, rel.nspname, rel.relnamespace; - - -- We don't want to react to alters triggered by superuser, - IF current_setting('is_superuser') = 'on' THEN - RAISE DEBUG 'no ddl trigger for superuser'; - RETURN; - END IF; - - PERFORM cartodb.cdb_disable_ddl_hooks(); - - -- CDB_CartodbfyTable must not create tables, or infinite loop will happen - newtable := cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation); - - PERFORM cartodb.cdb_enable_ddl_hooks(); - - RAISE DEBUG 'Inserting into cartodb.CDB_TableMetadata'; - - -- Add entry to CDB_TableMetadata (should CartodbfyTable do this?) - INSERT INTO cartodb.CDB_TableMetadata(tabname, updated_at) - VALUES (newtable, now()); - -END; $$; --- } - --- Table drop --- { -CREATE OR REPLACE FUNCTION cartodb.cdb_handle_drop_table () -RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $$ -DECLARE - event_info RECORD; -BEGIN - event_info := schema_triggers.get_relation_drop_eventinfo(); - - -- We're only interested in real relations - IF (event_info.old).relkind != 'r' THEN RETURN; END IF; - - RAISE DEBUG 'Relation % of kind % dropped from namespace oid %', - event_info.old_relation_oid, (event_info.old).relkind, (event_info.old).relnamespace; - - -- delete record from CDB_TableMetadata (should invalidate varnish) - DELETE FROM cartodb.CDB_TableMetadata WHERE tabname = event_info.old_relation_oid; - -END; $$; --- } - --- Column alter --- { -CREATE OR REPLACE FUNCTION cartodb.cdb_handle_alter_column () -RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $$ -DECLARE - event_info RECORD; - rel RECORD; - newtable REGCLASS; -BEGIN - event_info := schema_triggers.get_column_alter_eventinfo(); - - SELECT c.relname, c.relnamespace, c.relkind, n.nspname - FROM pg_class c - JOIN pg_namespace n - ON c.relnamespace = n.oid - WHERE c.oid = event_info.relation - INTO rel; - - RAISE DEBUG 'Column % altered by % (superuser? %) in relation % of kind %', - (event_info.old).attname, current_user, current_setting('is_superuser'), rel.relname, rel.relkind; - - -- We're only interested in real relations - IF rel.relkind != 'r' THEN RETURN; END IF; - - -- We don't want to react to alters triggered by superuser, - IF current_setting('is_superuser') = 'on' THEN - RAISE DEBUG 'no ddl trigger for superuser'; - RETURN; - END IF; - - PERFORM cartodb.cdb_disable_ddl_hooks(); - - newtable := cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation); - - PERFORM cartodb.cdb_enable_ddl_hooks(); - - -- update CDB_TableMetadata.updated_at (should invalidate varnish) - UPDATE cartodb.CDB_TableMetadata SET updated_at = NOW(), tabname = newtable - WHERE tabname = event_info.relation; - -END; $$; --- } - --- Column drop --- { -CREATE OR REPLACE FUNCTION cartodb.cdb_handle_drop_column () -RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $$ -DECLARE - event_info RECORD; - rel RECORD; - newtable REGCLASS; -BEGIN - event_info := schema_triggers.get_column_drop_eventinfo(); - - SELECT c.relname, c.relnamespace, c.relkind, n.nspname - FROM pg_class c - JOIN pg_namespace n - ON c.relnamespace = n.oid - WHERE c.oid = event_info.relation - INTO rel; - - RAISE DEBUG 'Column % drop by % (superuser? %) in relation % of kind %', - (event_info.old).attname, current_user, current_setting('is_superuser'), rel.relname, rel.relkind; - - -- We're only interested in real relations - IF rel.relkind != 'r' THEN RETURN; END IF; - - -- We don't want to react to drops triggered by superuser, - IF current_setting('is_superuser') = 'on' THEN - RAISE DEBUG 'no ddl trigger for superuser'; - RETURN; - END IF; - - - PERFORM cartodb.cdb_disable_ddl_hooks(); - - newtable := cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation); - - PERFORM cartodb.cdb_enable_ddl_hooks(); - - -- update CDB_TableMetadata.updated_at (should invalidate varnish) - UPDATE cartodb.CDB_TableMetadata SET updated_at = NOW(), tabname = newtable - WHERE tabname = event_info.relation; - -END; $$; --- } - --- Column add --- { -CREATE OR REPLACE FUNCTION cartodb.cdb_handle_add_column () -RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $$ -DECLARE - event_info RECORD; - rel RECORD; -BEGIN - event_info := schema_triggers.get_column_add_eventinfo(); - - SELECT c.relname, c.relnamespace, c.relkind, n.nspname - FROM pg_class c - JOIN pg_namespace n - ON c.relnamespace = n.oid - WHERE c.oid = event_info.relation - INTO rel; - - RAISE DEBUG 'Column % added by % (superuser? %) in relation % of kind %', - (event_info.new).attname, current_user, current_setting('is_superuser'), rel.relname, rel.relkind; - - -- We're only interested in real relations - IF rel.relkind != 'r' THEN RETURN; END IF; - - -- We don't want to react to drops triggered by superuser, - IF current_setting('is_superuser') = 'on' THEN - RAISE DEBUG 'no ddl trigger for superuser'; - RETURN; - END IF; - - -- update CDB_TableMetadata.updated_at (should invalidate varnish) - UPDATE cartodb.CDB_TableMetadata SET updated_at = NOW() - WHERE tabname = event_info.relation; - -END; $$; --- } - -CREATE OR REPLACE FUNCTION cartodb.cdb_disable_ddl_hooks() returns void AS $$ - DROP EVENT TRIGGER IF EXISTS cdb_on_relation_create; - DROP EVENT TRIGGER IF EXISTS cdb_on_relation_drop; - DROP EVENT TRIGGER IF EXISTS cdb_on_alter_column; - DROP EVENT TRIGGER IF EXISTS cdb_on_drop_column; - DROP EVENT TRIGGER IF EXISTS cdb_on_add_column; -$$ LANGUAGE sql; - -CREATE OR REPLACE FUNCTION cartodb.cdb_enable_ddl_hooks() returns void AS $$ - SELECT cartodb.cdb_disable_ddl_hooks(); - CREATE EVENT TRIGGER cdb_on_relation_create - ON "relation_create" EXECUTE PROCEDURE cartodb.cdb_handle_create_table(); - CREATE EVENT TRIGGER cdb_on_relation_drop - ON "relation_drop" EXECUTE PROCEDURE cartodb.cdb_handle_drop_table(); - CREATE EVENT TRIGGER cdb_on_alter_column - ON "column_alter" EXECUTE PROCEDURE cartodb.cdb_handle_alter_column(); - CREATE EVENT TRIGGER cdb_on_drop_column - ON "column_drop" EXECUTE PROCEDURE cartodb.cdb_handle_drop_column(); - CREATE EVENT TRIGGER cdb_on_add_column - ON "column_add" EXECUTE PROCEDURE cartodb.cdb_handle_add_column(); -$$ LANGUAGE sql; - --- Do not enable hooks by default ---SELECT cartodb.cdb_enable_ddl_hooks(); diff --git a/sql/test_setup.sql b/sql/test_setup.sql index 67fe684..cb4d895 100644 --- a/sql/test_setup.sql +++ b/sql/test_setup.sql @@ -1,5 +1,4 @@ CREATE EXTENSION postgis; -CREATE EXTENSION schema_triggers; CREATE EXTENSION plpythonu; CREATE EXTENSION cartodb; CREATE FUNCTION public.cdb_invalidate_varnish(table_name text) @@ -7,4 +6,4 @@ RETURNS void AS $$ BEGIN RAISE NOTICE 'cdb_invalidate_varnish(%) called', table_name; END; -$$ LANGUAGE 'plpgsql'; \ No newline at end of file +$$ LANGUAGE 'plpgsql'; From 8895d9f3afccdbdb269852b94e55d2c6b06c096f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Mart=C3=ADnez?= Date: Wed, 4 Nov 2015 17:26:38 +0100 Subject: [PATCH 2/6] Remove DDL from Makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 0a5b72d..2cb23b9 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ SED = sed CDBSCRIPTS = \ scripts-enabled/*.sql \ scripts-available/CDB_SearchPath.sql \ - scripts-available/CDB_DDLTriggers.sql \ scripts-available/CDB_ExtensionPost.sql \ scripts-available/CDB_ExtensionUtils.sql \ $(END) From cd5c8f2904afd86303a30bb6777d9097e6b8e1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Mart=C3=ADnez?= Date: Tue, 29 Dec 2015 10:42:54 +0100 Subject: [PATCH 3/6] Remove outdated references to schema triggers and change triggers --- doc/README.md | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/doc/README.md b/doc/README.md index a76d615..e18e32c 100644 --- a/doc/README.md +++ b/doc/README.md @@ -20,29 +20,4 @@ The CartoDB PostgreSQL extension is a module to load into each CartoDB user data # Checks -No user other than the superuser should be allowed to change `statement_timeout` for the session (SET statement_timeout disallowed). - User tables need to match certain structure criteria (See [[CartoDB-user-table]]) so the extension should provide a mean to enforce such structure everytime an attempt to change structure is encountered. - -# Events - -The events we want some function to be called upon are: - -| event | arguments to handler function | function duty | OK* | -|------------------------|--------------------------------------|----------------------------------|-----| -| SET variable | name of variable | forbid changing some vars | | -| RENAME table | old and new name + oid of the table | flush cache | | -| ADD/DROP/ALTER column | oid of the table | flush cache, cartodbfy, upd meta | Y | -| DISABLE/DROP trigger | oid of table, name of trigger | cartodbfy or forbid | | -| DROP table | oid of the table | flush cache and metadata | Y | -| CREATE table | oid of the table | cartodby, upd metadata | Y | -| GRANT | oid of table, privilege, role | flush cache, upd metadata | -| REVOKE | oid of table, privilege, role | flush cache, upd metadata | - - -* event available by installing https://github.com/CartoDB/pg_schema_triggers - -At this stage we don't need more than this, but the number of events and the number of arguments passed to the handler function may expand in the future, so the extension should be written in a way to easily allow that. - -Some of the handler will need to act _after_ the statement is completed (CREATE TABLE, for example). - From 045ede6908ccb1389741ec1a4902ea27887e2e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Mart=C3=ADnez?= Date: Tue, 29 Dec 2015 10:43:37 +0100 Subject: [PATCH 4/6] Remove schema_triggers from travis.yml --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb13a8a..875c2d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,14 +9,6 @@ before_install: - sudo apt-get update - sudo apt-get install -q postgresql-server-dev-9.3 - sudo apt-get install -q postgresql-plpython-9.3 - # Install schema_triggers - - hg clone https://bitbucket.org/malloclabs/pg_schema_triggers && - cd pg_schema_triggers && make && sudo make install && cd - - # Preload schema_triggers module - # NOTE: might change if we make it part of the installcheck instead - - echo "shared_preload_libraries = 'schema_triggers.so'" | - sudo tee -a /etc/postgresql/9.3/main/postgresql.conf && - sudo service postgresql restart script: - make From eb1222729dbf419dd941043bb7ffd827c93e4eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Mart=C3=ADnez?= Date: Thu, 21 Jan 2016 11:46:39 +0100 Subject: [PATCH 5/6] Remove ddl triggers specs --- Makefile | 3 +- expected/test_ddl_triggers.out | 199 --------------------------------- sql/test_ddl_triggers.sql | 102 ----------------- 3 files changed, 1 insertion(+), 303 deletions(-) delete mode 100644 expected/test_ddl_triggers.out delete mode 100644 sql/test_ddl_triggers.sql diff --git a/Makefile b/Makefile index eeb6c29..1f7eb2d 100644 --- a/Makefile +++ b/Makefile @@ -77,10 +77,9 @@ DATA_built = \ EXTRA_CLEAN = cartodb_version.sql DOCS = README.md -REGRESS_NEW = test_ddl_triggers REGRESS_OLD = $(wildcard test/*.sql) REGRESS_LEGACY = $(REGRESS_OLD:.sql=) -REGRESS = test_setup $(REGRESS_NEW) $(REGRESS_LEGACY) +REGRESS = test_setup $(REGRESS_LEGACY) PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) diff --git a/expected/test_ddl_triggers.out b/expected/test_ddl_triggers.out deleted file mode 100644 index 6746e61..0000000 --- a/expected/test_ddl_triggers.out +++ /dev/null @@ -1,199 +0,0 @@ -\set VERBOSITY terse --- Set user quota to infinite -SELECT CDB_SetUserQuotaInBytes(0); - cdb_setuserquotainbytes -------------------------- - 0 -(1 row) - --- Enable ddl triggers -SELECT cartodb.cdb_enable_ddl_hooks(); -NOTICE: event trigger "cdb_on_relation_create" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_drop" does not exist, skipping -NOTICE: event trigger "cdb_on_alter_column" does not exist, skipping -NOTICE: event trigger "cdb_on_drop_column" does not exist, skipping -NOTICE: event trigger "cdb_on_add_column" does not exist, skipping - cdb_enable_ddl_hooks ----------------------- - -(1 row) - -create schema c; -SELECT CDB_SetUserQuotaInBytes('c', 0); - cdb_setuserquotainbytes -------------------------- - 0 -(1 row) - -DROP USER IF EXISTS cartodb_postgresql_unpriv_user; -NOTICE: role "cartodb_postgresql_unpriv_user" does not exist, skipping -CREATE USER cartodb_postgresql_unpriv_user; -GRANT ALL ON SCHEMA c to cartodb_postgresql_unpriv_user; -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; ---SELECT session_user, current_user; ----------------------- --- CREATE TABLE ----------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select 1 as i INTO c.t3; -NOTICE: trigger "track_updates" for table "c.t3" does not exist, skipping -NOTICE: trigger "update_the_geom_webmercator_trigger" for table "c.t3" does not exist, skipping -NOTICE: trigger "test_quota" for table "c.t3" does not exist, skipping -NOTICE: trigger "test_quota_per_row" for table "c.t3" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_create" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_drop" does not exist, skipping -NOTICE: event trigger "cdb_on_alter_column" does not exist, skipping -NOTICE: event trigger "cdb_on_drop_column" does not exist, skipping -NOTICE: event trigger "cdb_on_add_column" does not exist, skipping -NOTICE: cdb_invalidate_varnish(c.t3) called -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)) as age -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - tabname | age ----------+----- - c.t3 | 0 -(1 row) - -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; --- Table with cartodb_id field, see --- http://github.com/CartoDB/cartodb-postgresql/issues/32 -select 1 as cartodb_id INTO c.t4; -NOTICE: trigger "track_updates" for table "c.t4" does not exist, skipping -NOTICE: trigger "update_the_geom_webmercator_trigger" for table "c.t4" does not exist, skipping -NOTICE: trigger "test_quota" for table "c.t4" does not exist, skipping -NOTICE: trigger "test_quota_per_row" for table "c.t4" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_create" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_drop" does not exist, skipping -NOTICE: event trigger "cdb_on_alter_column" does not exist, skipping -NOTICE: event trigger "cdb_on_drop_column" does not exist, skipping -NOTICE: event trigger "cdb_on_add_column" does not exist, skipping -NOTICE: cdb_invalidate_varnish(c.t4) called -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)) as age -FROM CDB_TableMetadata WHERE tabname = 'c.t4'::regclass; - tabname | age ----------+----- - c.t4 | 0 -(1 row) - ----------------------------- --- ALTER TABLE RENAME COLUMN ----------------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select pg_sleep(.1); - pg_sleep ----------- - -(1 row) - -alter table c.t3 rename column the_geom_webmercator to webmerc; -NOTICE: column "the_geom_webmercator" of relation "t3" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_create" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_drop" does not exist, skipping -NOTICE: event trigger "cdb_on_alter_column" does not exist, skipping -NOTICE: event trigger "cdb_on_drop_column" does not exist, skipping -NOTICE: event trigger "cdb_on_add_column" does not exist, skipping -NOTICE: cdb_invalidate_varnish(c.t3) called -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - tabname | agecs ----------+------- - c.t3 | 0 -(1 row) - -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select pg_sleep(.1); - pg_sleep ----------- - -(1 row) - -alter table c.t3 rename column the_geom_webmercator to webmerc2; -NOTICE: column "the_geom_webmercator" of relation "t3" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_create" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_drop" does not exist, skipping -NOTICE: event trigger "cdb_on_alter_column" does not exist, skipping -NOTICE: event trigger "cdb_on_drop_column" does not exist, skipping -NOTICE: event trigger "cdb_on_add_column" does not exist, skipping -NOTICE: cdb_invalidate_varnish(c.t3) called -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - tabname | agecs ----------+------- - c.t3 | 0 -(1 row) - ----------------------------- --- ALTER TABLE DROP COLUMN ----------------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select pg_sleep(.1); - pg_sleep ----------- - -(1 row) - -alter table c.t3 drop column the_geom_webmercator; -NOTICE: event trigger "cdb_on_relation_create" does not exist, skipping -NOTICE: event trigger "cdb_on_relation_drop" does not exist, skipping -NOTICE: event trigger "cdb_on_alter_column" does not exist, skipping -NOTICE: event trigger "cdb_on_drop_column" does not exist, skipping -NOTICE: event trigger "cdb_on_add_column" does not exist, skipping -NOTICE: cdb_invalidate_varnish(c.t3) called -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - tabname | agecs ----------+------- - c.t3 | 0 -(1 row) - ----------------------------- --- ALTER TABLE ADD COLUMN ----------------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select pg_sleep(.1); - pg_sleep ----------- - -(1 row) - -alter table c.t3 add column id2 int; -NOTICE: cdb_invalidate_varnish(c.t3) called -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - tabname | agecs ----------+------- - c.t3 | 0 -(1 row) - ----------------------------- --- DROP TABLE ----------------------------- -RESET SESSION AUTHORIZATION; -drop schema c cascade; -NOTICE: drop cascades to 3 other objects -select count(*) from CDB_TableMetadata; - count -------- - 0 -(1 row) - -DROP OWNED BY cartodb_postgresql_unpriv_user; -DROP ROLE cartodb_postgresql_unpriv_user; -DROP FUNCTION _CDB_UserQuotaInBytes(); diff --git a/sql/test_ddl_triggers.sql b/sql/test_ddl_triggers.sql deleted file mode 100644 index 6ed0d41..0000000 --- a/sql/test_ddl_triggers.sql +++ /dev/null @@ -1,102 +0,0 @@ -\set VERBOSITY terse - --- Set user quota to infinite -SELECT CDB_SetUserQuotaInBytes(0); - --- Enable ddl triggers -SELECT cartodb.cdb_enable_ddl_hooks(); - -create schema c; - -SELECT CDB_SetUserQuotaInBytes('c', 0); - -DROP USER IF EXISTS cartodb_postgresql_unpriv_user; -CREATE USER cartodb_postgresql_unpriv_user; -GRANT ALL ON SCHEMA c to cartodb_postgresql_unpriv_user; -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; ---SELECT session_user, current_user; - ----------------------- --- CREATE TABLE ----------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select 1 as i INTO c.t3; - -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)) as age -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; --- Table with cartodb_id field, see --- http://github.com/CartoDB/cartodb-postgresql/issues/32 -select 1 as cartodb_id INTO c.t4; - -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)) as age -FROM CDB_TableMetadata WHERE tabname = 'c.t4'::regclass; - ----------------------------- --- ALTER TABLE RENAME COLUMN ----------------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; - -select pg_sleep(.1); -alter table c.t3 rename column the_geom_webmercator to webmerc; - -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select pg_sleep(.1); -alter table c.t3 rename column the_geom_webmercator to webmerc2; - -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - ----------------------------- --- ALTER TABLE DROP COLUMN ----------------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select pg_sleep(.1); -alter table c.t3 drop column the_geom_webmercator; - -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - ----------------------------- --- ALTER TABLE ADD COLUMN ----------------------------- -SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; -select pg_sleep(.1); -alter table c.t3 add column id2 int; - -RESET SESSION AUTHORIZATION; -select - tabname::text, - round(extract('secs' from now() - updated_at)*10) as agecs -FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass; - ----------------------------- --- DROP TABLE ----------------------------- - -RESET SESSION AUTHORIZATION; -drop schema c cascade; -select count(*) from CDB_TableMetadata; - -DROP OWNED BY cartodb_postgresql_unpriv_user; -DROP ROLE cartodb_postgresql_unpriv_user; -DROP FUNCTION _CDB_UserQuotaInBytes(); From 845ac6dc9aab8f3d5e7d4ab04d76a371e5536e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Mart=C3=ADnez?= Date: Wed, 27 Jan 2016 14:25:07 +0100 Subject: [PATCH 6/6] Release 0.12.0 --- Makefile | 3 ++- NEWS.md | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1f7eb2d..45c591b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # cartodb/Makefile EXTENSION = cartodb -EXTVERSION = 0.11.5 +EXTVERSION = 0.12.0 SED = sed @@ -56,6 +56,7 @@ UPGRADABLE = \ 0.11.3 \ 0.11.4 \ 0.11.5 \ + 0.12.0 \ $(EXTVERSION)dev \ $(EXTVERSION)next \ $(END) diff --git a/NEWS.md b/NEWS.md index 5583f97..4511db8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +0.12.0 (2016-01-27) +------------------- +* Remove schema_triggers extension dependency, to ensure compatibility with PostgreSQL 9.5. [#190](https://github.com/CartoDB/cartodb-postgresql/pull/190) +* Remove DDL trigger functions (unused by CartoDB). + 0.11.5 (2015-11-27) ------------------- * Disable log invalidation time [#178](https://github.com/CartoDB/cartodb-postgresql/pull/178)