Re: improve CREATE EXTENSION error message

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: improve CREATE EXTENSION error message
Дата
Msg-id 1482885.1638223402@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: improve CREATE EXTENSION error message  (Daniel Gustafsson <daniel@yesql.se>)
Ответы Re: improve CREATE EXTENSION error message  ("Bossart, Nathan" <bossartn@amazon.com>)
Re: improve CREATE EXTENSION error message  (Chapman Flack <chap@anastigmatix.net>)
Список pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 29 Nov 2021, at 22:47, Bossart, Nathan <bossartn@amazon.com> wrote:
>> On 11/29/21, 1:38 PM, "Chapman Flack" <chap@anastigmatix.net> wrote:
>>> Maybe a larger break with the "This means the extension something something"
>>> formulation, and more on the lines of
>>> HINT:  an extension must first be present (for example, installed with a
>>> package manager) on the system where PostgreSQL is running.

>> I like this idea.  I can do it this way in the next revision if others
>> agree.

> I think taking it in this direction has merits.

I think "The extension must ..." would read better, otherwise +1.

I don't especially like intertwining the hint choice with the existing
special case for per-version files.  Our usual style for conditional
hints can be found in places like sysv_shmem.c, and following that
would lead to a patch roughly like

    if ((file = AllocateFile(filename, "r")) == NULL)
    {
+       int ext_errno = errno;
+
        if (version && errno == ENOENT)
        {
            /* no auxiliary file for this version */
            pfree(filename);
            return;
        }
        ereport(ERROR,
                (errcode_for_file_access(),
                 errmsg("could not open extension control file \"%s\": %m",
-                       filename)));
+                       filename),
+                (ext_errno == ENOENT) ? errhint("...") : 0));
    }

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Lots of memory allocated when reassigning Large Objects
Следующее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: improve CREATE EXTENSION error message