Re: BUG #19543: ALTER RULE ... RENAME accepts reserved name "_RETURN" for a non-view rule; breaks a restored dump

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: BUG #19543: ALTER RULE ... RENAME accepts reserved name "_RETURN" for a non-view rule; breaks a restored dump
Дата
в 17:37:37
Msg-id
38958.1783175857@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Re: BUG #19543: ALTER RULE ... RENAME accepts reserved name "_RETURN" for a non-view rule; breaks a restored dump Tom Lane <tgl@sss.pgh.pa.us>
PG Bug reporting form  writes:
> CREATE RULE rejects the name _RETURN for a rule that is not an ON SELECT
> rule. ALTER RULE ... RENAME does not: an existing ON UPDATE/INSERT/DELETE
> rule on an ordinary table can be renamed to _RETURN and the server accepts
> it.

Good catch, will fix.

While we're here, I'm tempted to discard the obsolete logic in
CREATE RULE's implementation of a related check:

        /*
         * ... and finally the rule must be named _RETURN.
         */
        if (strcmp(rulename, ViewSelectRuleName) != 0)
        {
            /*
             * In versions before 7.3, the expected name was _RETviewname. For
             * backwards compatibility with old pg_dump output, accept that
             * and silently change it to _RETURN.  Since this is just a quick
             * backwards-compatibility hack, limit the number of characters
             * checked to a few less than NAMEDATALEN; this saves having to
             * worry about where a multibyte character might have gotten
             * truncated.
             */
            if (strncmp(rulename, "_RET", 4) != 0 ||
                strncmp(rulename + 4, RelationGetRelationName(event_relation),
                        NAMEDATALEN - 4 - 4) != 0)
                ereport(ERROR,
                        (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
                         errmsg("view rule for \"%s\" must be named \"%s\"",
                                RelationGetRelationName(event_relation),
                                ViewSelectRuleName)));

We discarded compatibility with pre-7.3 dump files some time ago
(notably in e58a59975 and adjacent commits), but this small detail
wasn't noticed at the time.

			regards, tom lane


В списке pgsql-bugs по дате отправления
От: vaibhave postgres
Дата:
FAQ