Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATEand DELETE

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATEand DELETE
Дата
Msg-id 20170109225405.GC13529@fetter.org
обсуждение исходный текст
Ответ на Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATEand DELETE  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
On Mon, Jan 09, 2017 at 07:52:11PM -0300, Alvaro Herrera wrote:
> David Fetter wrote:
> 
> > +    if (query->commandType == CMD_UPDATE || query->commandType == CMD_DELETE)
> > +    {
> > +        /* Make sure there's something to look at. */
> > +        Assert(query->jointree != NULL);
> > +        if (query->jointree->quals == NULL)
> > +            ereport(ERROR,
> > +                    (errcode(ERRCODE_SYNTAX_ERROR),
> > +                     errmsg("%s requires a WHERE clause when the require_where hook is enabled.",
> > +                         query->commandType == CMD_UPDATE ? "UPDATE" : "DELETE"),
> > +                     errhint("To %s all rows, use \"WHERE true\" or similar.",
> > +                         query->commandType == CMD_UPDATE ? "update" : "delete")));
> > +    }
> 
> Per my earlier comment, I think this should use
> ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED instead.
> 
> I think this should say "the \"require_hook\" extension" rather than
> use the term "hook".
> 
> (There are two or three translatability rules violations in this
> snippet, but since this is an extension and those are not translatable,
> I won't say elaborate further.)

I'm happy to fix it.  Are the rules all in one spot I can refer to?

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATEand DELETE
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: [HACKERS] Increase pltcl test coverage