Re: [PATCH][PROPOSAL] Add enum releation option type

Поиск
Список
Период
Сортировка
От Alvaro Herrera from 2ndQuadrant
Тема Re: [PATCH][PROPOSAL] Add enum releation option type
Дата
Msg-id 20190905154227.GA5287@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: [PATCH][PROPOSAL] Add enum releation option type  (Nikolay Shaplov <dhyan@nataraj.su>)
Ответы Re: [PATCH][PROPOSAL] Add enum releation option type  (Nikolay Shaplov <dhyan@nataraj.su>)
Список pgsql-hackers
After looking closer once again, I don't like this patch.

I think the FOOBAR_ENUM_DEF defines serve no purpose, other than
source-code placement next to the enum value definitions.  I think for
example check_option, living in reloptions.c, should look like this:

    {
        {
            "check_option",
                "View has WITH CHECK OPTION defined (local or cascaded).",
                RELOPT_KIND_VIEW,
                AccessExclusiveLock
        },
        {
            { "local", VIEW_OPTION_CHECK_OPTION_LOCAL },
            { "cascaded", VIEW_OPTION_CHECK_OPTION_CASCADED },
            { NULL }
        },
        "Valid values are \"local\" and \"cascaded\"."
    },

Note the relopt_enum is pretty much the same you have, except we also
have a const char *valid_values_errdetail; and the ugly #define no
longer exists but instead we put it in enumRelOpts.

rel.h ends up like this:

/*
 * Values for ViewOptions->check_option.
 */
typedef enum
{
    VIEWOPTIONS_CHECK_OPTION_NOTSET,
    VIEWOPTIONS_CHECK_OPTION_LOCAL,
    VIEWOPTIONS_CHECK_OPTION_CASCADED
} ViewOpts_CheckOptionValues;

/*
 * ViewOptions
 *        Contents of rd_options for views
 */
typedef struct ViewOptions
{
    int32        vl_len_;        /* varlena header (do not touch directly!) */
    bool        security_barrier;
    ViewOpts_CheckOptionValues check_option;
} ViewOptions;

I'm marking this Waiting on Author.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Alvaro Herrera from 2ndQuadrant
Дата:
Сообщение: Re: [PATCH] Add support for ON UPDATE/DELETE actions on ALTERCONSTRAINT
Следующее
От: Tom Lane
Дата:
Сообщение: Re: CVE-2017-7484-induced bugs, or, btree cmp functions are not leakproof?