diff options
Diffstat (limited to 'src/backend/commands/user.c')
-rw-r--r-- | src/backend/commands/user.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index ccc586d8e85..aab5aa855d2 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -327,6 +327,15 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt) errdetail("Role names starting with \"pg_\" are reserved."))); /* + * If built with appropriate switch, whine when regression-testing + * conventions for role names are violated. + */ +#ifdef ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS + if (strncmp(stmt->role, "regress_", 8) != 0) + elog(WARNING, "roles created by regression test cases should have names starting with \"regress_\""); +#endif + + /* * Check the pg_authid relation to be certain the role doesn't already * exist. */ @@ -1212,6 +1221,15 @@ RenameRole(const char *oldname, const char *newname) newname), errdetail("Role names starting with \"pg_\" are reserved."))); + /* + * If built with appropriate switch, whine when regression-testing + * conventions for role names are violated. + */ +#ifdef ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS + if (strncmp(newname, "regress_", 8) != 0) + elog(WARNING, "roles created by regression test cases should have names starting with \"regress_\""); +#endif + /* make sure the new name doesn't exist */ if (SearchSysCacheExists1(AUTHNAME, CStringGetDatum(newname))) ereport(ERROR, |