diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 23c9d66f19410902a9bd8fd30d190b7bfbc7ddb7..1fd132fee526b5a3547b7609e8965573e978d891 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -1391,12 +1391,16 @@ CreateExtension(CreateExtensionStmt *stmt) */ List *search_path = fetch_search_path(false); - if (search_path == NIL) /* probably can't happen */ - elog(ERROR, "there is no default creation target"); + if (search_path == NIL) /* nothing valid in search_path? */ + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_SCHEMA), + errmsg("no schema has been selected to create in"))); schemaOid = linitial_oid(search_path); schemaName = get_namespace_name(schemaOid); if (schemaName == NULL) /* recently-deleted namespace? */ - elog(ERROR, "there is no default creation target"); + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_SCHEMA), + errmsg("no schema has been selected to create in"))); list_free(search_path); }