Re: WIP: Automatic view update rules

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: WIP: Automatic view update rules
Дата
Msg-id 603c8f070811112006q906b3a6o59a66228b7fc997@mail.gmail.com
обсуждение исходный текст
Ответ на Re: WIP: Automatic view update rules  (Bernd Helmle <mailings@oopsware.de>)
Ответы Re: WIP: Automatic view update rules  (Bernd Helmle <mailings@oopsware.de>)
Re: WIP: Automatic view update rules  (Decibel! <decibel@decibel.org>)
Список pgsql-hackers
I haven't done a full review of this patch, but here are some thoughts
based on a quick read-through:

- "make check" fails 16 of 118 tests for me with this patch applied.

- There are some unnecessary hunks in this diff.  For example, some of
the gram.y changes appear to move curly braces around, adjust spacing,
and replace true and false with TRUE and FALSE (I'm not 100% sure that
the last of these isn't substantive... but I hope it's not).   The
changes to rewriteDefine.c contain some commented-out declarations
that need to be cleaned up, and at least one place where a blank line
has been added.

- The doc changes for ev_kind describe 'e' as meaning "rule was
created by user", which confused me because why would you pick "e" for
that?  Then I realized that "e" was probably intended to mean
"explicit"; it would probably be good to work that word into the
documentation of that value somehow.

- Should this be an optional behavior?  What if I don't WANT my view
to be updateable?

- I am wondering if the old_tup_is_implicit variable started off its
life as a boolean and morphed into a char.  It seems misnamed, now, at
any rate.

- The capitalization of deleteImplicitRulesOnEvent is inconsistent
with the functions that immediately precede it in rewriteRemove.h.  I
think the "d" should be capitalized.  checkTree() also uses this style
of capitalization, which I haven't seen elsewhere in the source tree.

- This:

rhaas=# create table baz (a integer, b integer);
CREATE TABLE
rhaas=# create or replace view bar as select * from baz;
NOTICE:  CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
CREATE VIEW

Generates this update rule:

ON UPDATE TO bar DO INSTEAD  UPDATE ONLY foo SET a = new.a, b = new.b WHERE       CASE           WHEN old.a IS NOT NULL
THENold.a = foo.a           ELSE foo.a IS NULL       END AND       CASE           WHEN old.b IS NOT NULL THEN old.b =
foo.b          ELSE foo.b IS NULL       END RETURNING new.a, new.b
 

It seems like this could be simplified using IS NOT DISTINCT FROM.

...Robert


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

Предыдущее
От: Philip Warner
Дата:
Сообщение: Re: Meaning of transaction pg_locks?
Следующее
От: "Alex Hunsaker"
Дата:
Сообщение: Re: SSL cleanups/hostname verification