Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit530acda

Browse files
committed
Provide better message when CREATE EXTENSION can't find a target schema.
The new message (and SQLSTATE) matches the corresponding error cases innamespace.c.This was thought to be a "can't happen" case when extension.c was written,so we didn't think hard about how to report it. But it definitely canhappen in 9.2 and later, since we no longer require search_path to containany valid schema names. It's probably also possible in 9.1 if search_pathcame from a noninteractive source. So, back-patch to all releasescontaining this code.Per report from Sean Chittenden, though this isn't exactly his patch.
1 parent5c7603c commit530acda

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎src/backend/commands/extension.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,16 @@ CreateExtension(CreateExtensionStmt *stmt)
13941394
*/
13951395
List*search_path=fetch_search_path(false);
13961396

1397-
if (search_path==NIL)/* probably can't happen */
1398-
elog(ERROR,"there is no default creation target");
1397+
if (search_path==NIL)/* nothing valid in search_path? */
1398+
ereport(ERROR,
1399+
(errcode(ERRCODE_UNDEFINED_SCHEMA),
1400+
errmsg("no schema has been selected to create in")));
13991401
schemaOid=linitial_oid(search_path);
14001402
schemaName=get_namespace_name(schemaOid);
14011403
if (schemaName==NULL)/* recently-deleted namespace? */
1402-
elog(ERROR,"there is no default creation target");
1404+
ereport(ERROR,
1405+
(errcode(ERRCODE_UNDEFINED_SCHEMA),
1406+
errmsg("no schema has been selected to create in")));
14031407

14041408
list_free(search_path);
14051409
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp