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

Commit2ff74ef

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 parent612ecf3 commit2ff74ef

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
@@ -1391,12 +1391,16 @@ CreateExtension(CreateExtensionStmt *stmt)
13911391
*/
13921392
List*search_path=fetch_search_path(false);
13931393

1394-
if (search_path==NIL)/* probably can't happen */
1395-
elog(ERROR,"there is no default creation target");
1394+
if (search_path==NIL)/* nothing valid in search_path? */
1395+
ereport(ERROR,
1396+
(errcode(ERRCODE_UNDEFINED_SCHEMA),
1397+
errmsg("no schema has been selected to create in")));
13961398
schemaOid=linitial_oid(search_path);
13971399
schemaName=get_namespace_name(schemaOid);
13981400
if (schemaName==NULL)/* recently-deleted namespace? */
1399-
elog(ERROR,"there is no default creation target");
1401+
ereport(ERROR,
1402+
(errcode(ERRCODE_UNDEFINED_SCHEMA),
1403+
errmsg("no schema has been selected to create in")));
14001404

14011405
list_free(search_path);
14021406
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp