Use return value from cartodbfy

This commit is contained in:
Rafa de la Torre 2015-08-14 17:41:55 +02:00
parent 565edcb50d
commit 47d8429277

View File

@ -31,14 +31,12 @@ BEGIN
PERFORM cartodb.cdb_disable_ddl_hooks();
-- CDB_CartodbfyTable must not create tables, or infinite loop will happen
PERFORM cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation);
newtable := cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation);
PERFORM cartodb.cdb_enable_ddl_hooks();
RAISE DEBUG 'Inserting into cartodb.CDB_TableMetadata';
newtable := Format('%s.%s', rel.nspname, rel.relname)::regclass;
-- Add entry to CDB_TableMetadata (should CartodbfyTable do this?)
INSERT INTO cartodb.CDB_TableMetadata(tabname, updated_at)
VALUES (newtable, now());
@ -99,12 +97,10 @@ BEGIN
PERFORM cartodb.cdb_disable_ddl_hooks();
PERFORM cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation);
newtable := cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation);
PERFORM cartodb.cdb_enable_ddl_hooks();
newtable := Format('%s.%s', rel.nspname, rel.relname)::regclass;
-- update CDB_TableMetadata.updated_at (should invalidate varnish)
UPDATE cartodb.CDB_TableMetadata SET updated_at = NOW(), tabname = newtable
WHERE tabname = event_info.relation;
@ -145,12 +141,10 @@ BEGIN
PERFORM cartodb.cdb_disable_ddl_hooks();
PERFORM cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation);
newtable := cartodb.CDB_CartodbfyTable(rel.nspname, event_info.relation);
PERFORM cartodb.cdb_enable_ddl_hooks();
newtable := Format('%s.%s', rel.nspname, rel.relname)::regclass;
-- update CDB_TableMetadata.updated_at (should invalidate varnish)
UPDATE cartodb.CDB_TableMetadata SET updated_at = NOW(), tabname = newtable
WHERE tabname = event_info.relation;