Enable running all tests via "installcheck"

NOTE: also makes CDB_TableMetadata triggers still functional
      when user quota and varnish invalidation functions are missing
      from the database (currently installed by cartodb ruby)
This commit is contained in:
Sandro Santilli
2014-05-06 10:18:38 +02:00
parent 82c8259de6
commit 15740f2ef6
10 changed files with 81 additions and 19 deletions

View File

@@ -35,7 +35,12 @@ BEGIN
IF dice < pbfact THEN
RAISE DEBUG 'Checking quota on table % (dice:%, needed:<%)', TG_RELID::text, dice, pbfact;
qmax := public._CDB_UserQuotaInBytes();
BEGIN
qmax := public._CDB_UserQuotaInBytes();
EXCEPTION WHEN undefined_function THEN
RAISE WARNING 'Missing _CDB_UserQuotaInBytes(), assuming no quota';
RETURN NEW;
END;
SELECT CDB_UserDataSize() INTO quota;
IF quota > qmax THEN
RAISE EXCEPTION 'Quota exceeded by %KB', (quota-qmax)/1024;

View File

@@ -82,7 +82,11 @@ BEGIN
--
-- LISTEN cdb_tabledata_update;
--
PERFORM cdb_invalidate_varnish(tabname);
BEGIN
PERFORM cdb_invalidate_varnish(tabname);
EXCEPTION WHEN undefined_function THEN
RAISE WARNING 'Missing cdb_invalidate_varnish()';
END;
RETURN NULL;
END;

View File

@@ -22,7 +22,7 @@ AS $$
'spatial_ref_sys'
)
), perms AS (
SELECT t, has_table_privilege('publicuser', 'public.'||t, 'SELECT') as p
SELECT t, has_table_privilege('publicuser', t, 'SELECT') as p
FROM usertables
)
SELECT t FROM perms