Require superuser when using non-existent job schema in worker_merge_files_into_table

pull/2490/head
Marco Slot 2018-11-24 02:57:16 +01:00
parent c4ad899dd8
commit e8e956aa9f
1 changed files with 11 additions and 0 deletions

View File

@ -100,6 +100,17 @@ worker_merge_files_into_table(PG_FUNCTION_ARGS)
schemaExists = JobSchemaExists(jobSchemaName);
if (!schemaExists)
{
/*
* For testing purposes, we allow merging into a table in the public schema,
* but only when running as superuser.
*/
if (!superuser())
{
ereport(ERROR, (errmsg("job schema does not exist"),
errdetail("must be superuser to use public schema")));
}
resetStringInfo(jobSchemaName);
appendStringInfoString(jobSchemaName, "public");
}