Better exception handling

This commit is contained in:
Carla Iriberri
2016-03-01 17:43:21 +01:00
parent 32307ceef0
commit 1198454046

View File

@@ -521,11 +521,14 @@ BEGIN
BEGIN
sql := Format('ALTER TABLE %s ALTER cartodb_id TYPE int USING %I::integer', reloid::text, rec.attname);
RAISE DEBUG 'Running %', sql;
RAISE DEBUG 'CDB(_CDB_Has_Usable_Primary_ID): Running %', sql;
EXECUTE sql;
EXCEPTION
WHEN invalid_text_representation THEN
RAISE DEBUG 'CDB(_CDB_Has_Usable_Primary_ID): Column % of type text is not a valid integer column', rec.attname;
useable_key := false;
WHEN others THEN
RAISE DEBUG 'Column % of type text is not a valid integer column', rec.attname;
RAISE DEBUG 'CDB(_CDB_Has_Usable_Primary_ID): Exception %', SQLSTATE;
useable_key := false;
END;