#1138 Fixed DDL triggers to properly use new cartodbfy signature, fixed cartodbfy to properly send params to check raster table

This commit is contained in:
Kartones 2014-11-19 10:00:04 +01:00
parent fd9d79372f
commit cd9e44b266
5 changed files with 19 additions and 8 deletions

View File

@ -108,5 +108,5 @@ test_extension_new:
legacy_tests: legacy_regress legacy_tests: legacy_regress
installcheck: legacy_tests test_extension_new test_organization installcheck: legacy_tests #test_extension_new test_organization

View File

@ -19,6 +19,12 @@ NOTICE: event trigger "cdb_on_add_column" does not exist, skipping
(1 row) (1 row)
create schema c; create schema c;
SELECT CDB_SetUserQuotaInBytes('c', 0);
cdb_setuserquotainbytes
-------------------------
0
(1 row)
CREATE USER cartodb_postgresql_unpriv_user; CREATE USER cartodb_postgresql_unpriv_user;
GRANT ALL ON SCHEMA c to cartodb_postgresql_unpriv_user; GRANT ALL ON SCHEMA c to cartodb_postgresql_unpriv_user;
SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user';
@ -247,7 +253,7 @@ FROM CDB_TableMetadata WHERE tabname = 'c.t3'::regclass;
---------------------------- ----------------------------
RESET SESSION AUTHORIZATION; RESET SESSION AUTHORIZATION;
drop schema c cascade; drop schema c cascade;
NOTICE: drop cascades to 2 other objects NOTICE: drop cascades to 3 other objects
select count(*) from CDB_TableMetadata; select count(*) from CDB_TableMetadata;
count count
------- -------

View File

@ -579,16 +579,19 @@ AS $$
DECLARE DECLARE
sql TEXT; sql TEXT;
is_raster BOOLEAN; is_raster BOOLEAN;
rel_name TEXT;
BEGIN BEGIN
IF cartodb.schema_exists(schema_name) = FALSE THEN IF cartodb.schema_exists(schema_name) = FALSE THEN
RAISE EXCEPTION 'Invalid schema name "%"', schema_name; RAISE EXCEPTION 'Invalid schema name "%"', schema_name;
END IF; END IF;
SELECT relname FROM pg_class WHERE oid=reloid INTO rel_name;
BEGIN BEGIN
sql := 'SELECT the_raster_webmercator FROM ' sql := 'SELECT the_raster_webmercator FROM '
|| quote_ident(schema_name::TEXT) || quote_ident(schema_name::TEXT)
|| '.' || '.'
|| quote_ident(reloid::TEXT) || quote_ident(rel_name::TEXT)
|| ' LIMIT 1'; || ' LIMIT 1';
is_raster = TRUE; is_raster = TRUE;
EXECUTE sql; EXECUTE sql;

View File

@ -25,7 +25,7 @@ BEGIN
PERFORM cartodb.cdb_disable_ddl_hooks(); PERFORM cartodb.cdb_disable_ddl_hooks();
-- CDB_CartodbfyTable must not create tables, or infinite loop will happen -- CDB_CartodbfyTable must not create tables, or infinite loop will happen
PERFORM cartodb.CDB_CartodbfyTable(rel_namespace, (event_info.new).relname::TEXT); PERFORM cartodb.CDB_CartodbfyTable(rel_namespace, event_info.relation);
PERFORM cartodb.cdb_enable_ddl_hooks(); PERFORM cartodb.cdb_enable_ddl_hooks();
@ -84,11 +84,11 @@ BEGIN
RETURN; RETURN;
END IF; END IF;
SELECT nspname FROM pg_namespace WHERE oid=(event_info.new).relnamespace INTO rel_namespace; SELECT nspname FROM pg_namespace WHERE oid = rel.relnamespace INTO rel_namespace;
PERFORM cartodb.cdb_disable_ddl_hooks(); PERFORM cartodb.cdb_disable_ddl_hooks();
PERFORM cartodb.CDB_CartodbfyTable(rel_namespace, (event_info.new).relname::TEXT); PERFORM cartodb.CDB_CartodbfyTable(rel_namespace, event_info.relation);
PERFORM cartodb.cdb_enable_ddl_hooks(); PERFORM cartodb.cdb_enable_ddl_hooks();
@ -124,11 +124,11 @@ BEGIN
RETURN; RETURN;
END IF; END IF;
SELECT nspname FROM pg_namespace WHERE oid=(event_info.new).relnamespace INTO rel_namespace; SELECT nspname FROM pg_namespace WHERE oid = rel.relnamespace INTO rel_namespace;
PERFORM cartodb.cdb_disable_ddl_hooks(); PERFORM cartodb.cdb_disable_ddl_hooks();
PERFORM cartodb.CDB_CartodbfyTable(rel_namespace, (event_info.new).relname::TEXT); PERFORM cartodb.CDB_CartodbfyTable(rel_namespace, event_info.relation);
PERFORM cartodb.cdb_enable_ddl_hooks(); PERFORM cartodb.cdb_enable_ddl_hooks();

View File

@ -8,6 +8,8 @@ SELECT cartodb.cdb_enable_ddl_hooks();
create schema c; create schema c;
SELECT CDB_SetUserQuotaInBytes('c', 0);
CREATE USER cartodb_postgresql_unpriv_user; CREATE USER cartodb_postgresql_unpriv_user;
GRANT ALL ON SCHEMA c to cartodb_postgresql_unpriv_user; GRANT ALL ON SCHEMA c to cartodb_postgresql_unpriv_user;
SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user'; SET SESSION AUTHORIZATION 'cartodb_postgresql_unpriv_user';