some ri_triggers.c cleanup

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема some ri_triggers.c cleanup
Дата
Msg-id 0ccdd3e1-10b0-dd05-d8a7-183507c11eb1@2ndquadrant.com
обсуждение исходный текст
Ответы Re: some ri_triggers.c cleanup  (Corey Huinker <corey.huinker@gmail.com>)
Список pgsql-hackers
ri_triggers.c is endlessly long and repetitive.  I want to clean it up a
bit (more).

I looked into all these switch cases for the unimplemented MATCH PARTIAL
option.  I toyed around with how a MATCH PARTIAL implementation would
actually look like, and it likely wouldn't use the existing code
structure anyway, so let's just simplify this for now.

First, have ri_FetchConstraintInfo() check that riinfo->confmatchtype
is valid.  Then we don't have to repeat that everywhere.

In the various referential action functions, we don't need to pay
attention to the match type at all right now, so remove all that code.
A future MATCH PARTIAL implementation would probably have some
conditions added to the present code, but it won't need an entirely
separate switch branch in each case.

In RI_FKey_fk_upd_check_required(), reorganize the code to make it
much simpler.

Separately, the comment style is also very generous and wasteful with
vertical space.  That can be shrunk a bit.

Attached are some patches.

Final score:

branch          wc -l
REL9_6_STABLE   3671
REL_10_STABLE   3668
REL_11_STABLE   3179
master          3034
patch           2695

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: WIP: Avoid creation of the free space map for small tables
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [patch] Add schema total size to psql \dn+