Re: [PATCH] Cleanup: unify checks for catalog modification

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [PATCH] Cleanup: unify checks for catalog modification
Дата
Msg-id 20141015020009.GH7043@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: [PATCH] Cleanup: unify checks for catalog modification  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> Marti Raudsepp <marti@juffo.org> writes:
> > I happened to notice that there are no less than 14 places in the code
> > that check whether a relation is a system catalog and throwing the
> > error "permission denied: "foo" is a system catalog"
> 
> > The attached patch factors all of those into a single
> > ForbidSystemTableMods() function. Is this considered an improvement?
> 
> I'd argue not.  The code bulk savings is minimal, and this change
> would degrade the usefulness of the file/line number reporting that's
> built into ereport().

Along these lines, I've sometimes thought that it could be useful to
pass down file/line info from certain callers down to certain generic
check subroutines such as the one being proposed here.  (I can't recall
any specific examples offhand.)  Of course, doing it manually would be
very tedious and error prone, but perhaps we could have something like a
macro system that both sets up arguments in the called function, and
sets up the values in the callee.

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



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Cleanup: unify checks for catalog modification
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Wait free LW_SHARED acquisition - v0.9