Re: Improved error message for CREATE EXTENSION patch...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improved error message for CREATE EXTENSION patch...
Date: 2013-06-04 20:14:22
Message-ID: 3690.1370376862@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sean Chittenden <sean(at)chittenden(dot)org> writes:
> I ran in to the following situation:
>> SET search_path = ENOENT, also_does_not_exist;
>> CREATE EXTENSION pg_repack;
>> ERROR: XX000: there is no default creation target
>> LOCATION: CreateExtension, extension.c:1395

> Which left me checking out the source code to figure out exactly what the problem was. Attached is an improved error message:

>> "ERROR: XX000: no schemas in search_path are available for CREATE EXTENSION"

Hm, I'm not sure that's much better than the existing wording. The
bigger point here though is that if we consider this to be a user-facing
error case, it ought to be ereport not elog.

I checked what you get for the normal non-extension case:

regression=# set search_path = bogus;
SET
regression=# create table t1 (f1 int);
ERROR: no schema has been selected to create in
regression=# \set VERBOSITY verbose
regression=# create table t1 (f1 int);
ERROR: 3F000: no schema has been selected to create in
LOCATION: RangeVarGetCreationNamespace, namespace.c:485

Seems like we ought to use the same message (and SQLSTATE) as in
namespace.c, since nobody's complained about that one.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Kerr 2013-06-04 20:15:48 Re: Which table stored in which file in PGDATA/base/[db-oid]
Previous Message Tom Lane 2013-06-04 20:07:23 Re: Configurable location for extension .control files