Fix many tests and handle ownership issues involved
with Cartodbfy being invoked by schema triggers. Some issues with regclass interpretation in tests still remain. Some issues with slightly different behavior to old version remain. Some issues with error messages / notification messages changing a little still remain.
This commit is contained in:
@@ -973,6 +973,15 @@ BEGIN
|
||||
sql := Format('DROP TABLE %s', reloid::text);
|
||||
PERFORM _CDB_SQL(sql, '_CDB_Rewrite_Table');
|
||||
|
||||
-- If the table is being created by a SECURITY DEFINER function
|
||||
-- make sure the user is set back to the user who is connected
|
||||
IF current_user != session_user THEN
|
||||
sql := Format('ALTER TABLE IF EXISTS %s OWNER TO %s', copyname, session_user);
|
||||
PERFORM _CDB_SQL(sql, '_CDB_Rewrite_Table');
|
||||
sql := Format('ALTER SEQUENCE IF EXISTS %s OWNER TO %s', destseq, session_user);
|
||||
PERFORM _CDB_SQL(sql, '_CDB_Rewrite_Table');
|
||||
END IF;
|
||||
|
||||
-- If we used a temporary destination table
|
||||
-- we can now rename it into place
|
||||
IF destschema = relschema THEN
|
||||
|
||||
Reference in New Issue
Block a user