WIP: Automatic view update rules

Started by Bernd Helmleabout 17 years ago27 messages
#1Bernd Helmle
mailings@oopsware.de
1 attachment(s)

Please find attached my current patch for automatic view update rules.
This is a stripped down version of my former patch discussed before 8.3
without CHECK OPTION support and less invasive changes to the rewriter
itself.

I'm currently cleaning up the code with all occurences of multiple base
relations (in progress) hence supporting SQL92 at the moment, only

If we decide to go further with this approach i would like to work on the
CHECK OPTION implementation based on some ideas we had in the past (e.g.
rewriter/executor support).

Note that i'm still working on this (for example, RETURNING is missing
yet), As always, discussion welcome ;)

--
Thanks

Bernd

Attachments:

view_update.patch.bz2application/octet-stream; name=view_update.patch.bz2Download
#2Bernd Helmle
mailings@oopsware.de
In reply to: Bernd Helmle (#1)
1 attachment(s)
Re: WIP: Automatic view update rules

--On Donnerstag, Oktober 30, 2008 21:24:08 +0100 Bernd Helmle
<mailings@oopsware.de> wrote:

Note that i'm still working on this (for example, RETURNING is missing
yet), As always, discussion welcome ;)

This new version implements RETURNING support for implicit view update
rules and does some further cleanups.

--
Thanks

Bernd

Attachments:

view_update.patch.bz2application/octet-stream; name=view_update.patch.bz2Download
BZh91AY&SY"Q�,O��}?�����������`j�G�R�>�}��t6��]�������f����<��mg��z/�X���@QM�:�W�^�[-{�>7�/��y���O�������3m�����T��1��QQ�/Ow�M��s[F}��[>��6i�M����:�q��}�����;��3����������}�_{+�����q�o^�����������k�Ss�����^�={U��lm���y��[T�s��R
�Z���m������R�l�{9�}�!��k�w���I�N�	M�&@#)�`D�"zh��~��L��6�I�A)�B@@��5=)���Q�G�����P�h$�DDF�LR����O��OE=�7�m4��(����=A��I�����SSO&��(���@��"D��5O�L&��'�M��jx)���4��h
D�LF���FS��1I��
�����?S����z{g<J�
��dYp�����6��������I��j��J��F�2V��5
ei������V?��(�D~�	�Z�C#�
���
-�]-���mIZ���/�����j�i13IL�(��Bd�h�HD("}�N�w]�)[mF��������x�Pb/�B�Y,L�&��J�;�������0Y"$��kC��a	3��Q�D��x%4��%5-�h=S����Y65z�����z]�,Y�Z�%����T��;�����OF�s�x���<�,�AV

�h�J2h��, B�BB
%"F�
#5�����Uv�Y��R���G��|-L31L�()���!
j=��I�6���K5+I�QM41��!Q���u)��I��0�P��6�33`���F�ESc"2���iH�S$�#B���W����t����>W *��R�E�)�J,�&�,KiR��mi��Ke5�"!��"l	\���`�I7b�?0
g��sox5�4���o��v���rL��1����>[p���$�c��(gAF�=��]F$6�y�e4�9�idh��tD�����w�e���b?��%]6O%����=g3�~'�A��7^����@h����Mt��%���W�]�P7
N�D������9����r�=����������b��A|��^�[7�s�����]�N{�MZ4�!j���&$%�nj�&p�[��{�/�kJ���_I��~\~���}�g0F��F`i���8��y��>�����]�j����%o������TL���>����7���?%���_�]����G�w������':��'�!�}���#�Y�����we%�m���S�����#�K�Q���}m-�������iEw;ta�Zj��oZ�6l�������^��r�t"4
���oim��Xmfez�����>\���OvO�����_K}L���T_-C��*���kWM�|��f���
���K��f9���2�E8�F��4���WJ��a<�r�p*4Bd

A�U�C�l�e���%+T�W��y�7��,�>U����+,�0B���?���k[ ���>�V�kX�ZTm&h����[1��V,���f5�`�2�F�]{f��Fm�R��,�E#��w1^r�w"@-�X�m�*��_gbH��I���w>>���T��vm5sd�f[���Z=j���.U������|���
�,�^��,�;y�`��z����ON==9��7�����*Z
OL|`~��{�m�������v�;������$
�#�#����2Cf�zG���nzu<�%����v�[�W�W;U�z�a��������
��/��y�����<�(<y.Z�%@iS�'6Uwr_�I��=��^QT9����#Y)9���#���'�d��z4m
�,U9��g�T�`�������gt��-��s��l��s��>������u�m|=�A���+����b� �����~����m�
�k��m\�Y1�]vJ�KIqF
M�Ln��\��K.�n��v��������3ZMb�6+cV��tKe6�,V��X�].���n�&�f�����"��\���Z�ZKY���]��uV�f���[�����d�����F�4�ci:m����M���3Z4IRt�t�k*d�f�3(J�[&�M����iCf�h��-i����f�Bo+���:c�F�
7����wL��vQ�wG�(�J�4� ���IJ�������M����qB�wLN2�d���3�&�d�@�U��������8��d��e�p��i$�I$�V{�?m�X�������c
�,� w����0~��??����[�?O&
)KK��Z����f�ODK�\����1�(B�{�E6<��sa$��)E�Qp�>��[�A$	�b�@wJ���{�T�l�����,�2C���
!rF�L��>TP�@]���N~R��tg��{-�����TBX
��SD��V|H[������=#���O��#'&���E����,$�����F$~�bK����h�I1�BG��~PCN�o�z7-������HLZ�G?�x��sPL���%)��f�������S�9B��#~���Bg�������1�N��s�
4���\\"�HL�4� lTJ�Rj�W2���b_~�YJ�6!�v�4	"�1A`��v/��(,UZ�����s�N�7�
;�V�f�0����q�C|�8����>�������gk��U=LEg�����gS��aT���s��!�����|��+�|+���O��������){��������p{s�^�����D"2{s��3\{.�6Y
���]����1xsf�[����b��f��MV���s�R|��>��\��`c���}��/=hT7�%�ES�M��=SC��"��3	�#V#�Se�HSm!���]!����a
!��0d��t�[s`VP����G�?����������S����R�����I�5�+%7�ty��GS�sn��~~����_+3� ��!No
N���$!e�����mN_�wf�TUQS��DEA!"M��<�>g���$$��y�������
i{T~?���>������U�`y�P<�g����X��~���JH��4/�s����&K�t����G��Fs�����K��ga���7"��&�`eW�uZ���;��B�z������ �e�t��aV���R����"��Y�8KPQ6�]{�l"d5����J4T�D��*m���O����F�$��qE����R��V��M�;j�w7��JK<Q���O����4`tLR-o�J'��}��d�~���1�s!�*��6G���UQ�1'
Se>�f�	�\<����x�\������]�u�_~>�����2����+�zm'lN��c+��jcc��ca	$�pp_�-���"G�`�9�zI�7��������T���'fH
s����|T�S�%�
m�1��G�������p4���Q&'uRKuso����7*�������(	P�jmn��dam"X��32�H�LZOWG���uZ��<vt���prU����|s����AC=�����J!���1����TV7R���L�����v�V��y���1q�kE�W���������������$��|��ca����+,6/pdD$�wvt��t�>�e.a��}z8���|�70�Y���N����O��py���#r:
���~�����UI)*5U�a��lv��S���}r|�:�Z�������^
,,;V�j)w��I�����a9M�&`N>����\:���;�8A�x�v���R~N�C���?_��b�v�>�GWk=�xe�����2����fR���������|#����������O�/fx��kC�A��Ux�v�"�L�/	�zWW�_����nI+��\�6��8�q�yE"yf��eM����r{��q��6y�.c}s�@jY'�k�8��k!��8�'�+�z&>;����Lw�!�m�e����D��@��&��E��l�3����}hI�����;!L�N�����V�(��y���i'MW~��k�X����ftk�2I�����aU��a��80�����+�a��0#���������xH�_�,aP�C�w+��'�2)/�����<���m�����!�e�����^�UW����x��\^��<Tq-���c�|K��&��m����anc��{��IH&.�X`gvY�u�)Yx��60���������6����m�B+��ss|�T*�������qf����o���,5�U���?#��v)��� ���h�����4I�.����H�7�>�*�jcB�	�����yk5�����+��F|�@H����n���z~U_���L�k<���.V�mK	��)���G�4�Y�D!����9��������R����a+��m��+��6�W���&���q���j����|������Ol9F��~�dH�e�p}w/��EW���;4��<��6�f���p�����������Y�m��]{rJ���qW������^/U���1���x�:�wZi����'�5[���!~��lv�w6X'�)�|5/n��q���wOX�����ZC�jf��N�l�k�g���7�_E����#���Cqq<d��)����~���v��l��[8����>l�E��3rf
<��\�i*����\P����m��Y����U�EII�S���n��f��t�r�{���^�0)_��+���K�\q��EG�Bd��z�:����G:NM�e�0����g�XGU2kSU�sd�N��q��!��8�������w��gbW
�v���^W~/�^�QL��]��y������-����	����o����_�FG\j6|u9����!&�E
�����%v�Q
�����]��������*m,�,o��m��&��[[4.�~8E_O����������B��o{G��2_��g����m�U��p�t��%-�%?�\K�|���x�l��k���K�U�b�r�^g��M���������l�-;�`V	�F���p�~���XX�^j�����b������a/��y����t�MG�b���.�n��f��8���
6��h}�|s�>]e�mR�b;��
��i� �3���T���(L����W�4�z�N[�L���r�R����p�<�G:�nA���^������-V�����}m�SD�����p�/)�m7�LUj:|e�F�?o>$O����O��E�8cd��t�Q
���
����o��z��� fBfo�u�L�H�d��`�T���M��'6�7�k>�	�;���T-���JbG}O�����i��
����K����s����a�=g};��y�����������k����;]W���fx [g(�
5�~��~q�y��������ez�����1^�wlu�oS���W��EF�����WY<������fv���wU��o��F8���*��'��������D���,�E����4�h���������Q�����{Q��Ck�8�����-��d�ey"��"���o�MKT3'N�&���z���Nn�g����U<"~���
�C�r ���\P�����f�IN��Y�x�	���
�������������P�]�6��	�e����g�;o��?�s%`��|\$������.O6PK�}��][���Wf�N���{2�RHz��[���\;�� ���Z-}J)�J^�n�l��V��j�Z\�P�������s�[ ��x�Q�/���8�O���WJ*�y��	2���-B��Xb4�����yX�kw��/��k���D��G��<A��������v5q9�-4"����.��um)�p�,��'�t}�o����0mM��#9�8*�h!��d(��Dj6)��"N�xQ%���-�:e�`�4��iT���K1���]�
�
�f}�����������0�����E����E/a�H�"��`L��0�������G��~�����:���nz�~Y�|��Q�E�y�����M/v�)��"a������a�O\��.�L(D�)n��/N9
��lm�u��j6h����i�$(���'�?�2�u����E�����4�n?I�=/����=����J����s0��0���F��Q`R�Ym3���z�{��:�F������c�����rQ�f����H}�Zs�Z�7eXn�%��P��v9'�����`x���;HW�|E�q�oEx�Y�'�M��I��!���uN�f���pCx�/�},o^��
L�V4����b��Ut���:�5cr?j�	���\
h����];\��9���>�d�%B:l������O,�.���.��+4��>�^�Bf�	�������]�X�#G���B�iq�<�O.��Y��U�W�*��p�{���
�����(��F'�o8yR|�O?dD����q/�<Iap���7B�H�
=��XCVPy�����
.��p��;ef�rS����
Li����'X>����
�[����t�����:2t{��yk�9d�d����+�q�?Ew�r��n]<�J������/������j����������Z����=�aw��J:�FeiyV��y�~uj���/�������X������K#����C:�im��!��?���3�^���=w�s��S�i���V��5s�| 	?x�E%��m�5D��a��A��j�k�Qh�n�#42d��(�4d����L�%�n75!�"�j�������uzMF��i�+%4�]�^^v�:��}5�2b�	�����L�"���AA�B����#�m#�p�_�dQ"!� ����>z3���L�?��X���s�`*�&6(��PuQYdDC���K����>P��C.����y)��&Z@����LS���3�D�J�����R:�����i�^[��c��]\L����*,�I��c�����J���T��<����m�Z|�R,��m�fC����:N���2Vp��?q��k"~l�Cl+F��dAa��'��3�iUMz�*���}��X�r/��[\����>��.&��:�R��?f�=��+�	���77ev���-�����gW����
!6�fv������k�9������'}�S���'z8;��u��FX~2�,I��-XV���w����A^p������{��2q�v�J{�����|	M��mr���[�����9����{/�?>y��]oeod��K�//p`�lq�b�>�,P�����Lk�����W�g�?����������F~J����R���-��q�L�cS����J��$�?��)��B����)D��O�����S\���Q$ M�J��-�nA��/���dI; x3g?�zi�	���X�QPVe�E)�q5����E���,���}�T�����l���e-��V�s���gEq~���n3O.,F}��~M����7v��e[����qd����,?�����<��Ht��i�gUb�f���;��1�������%G3�D��h�)W�h���K.{T��\����|�[ �TR���^}!�/?�����WSR\���y�s�)6�z�8��\|���G����d�*���$223��^i.�6�
���~�5?��j���+����Rj�,h�D<B��������c�U����s�U�I:
���v{G�`���!��y$�Du2���/���Y�����	b�}A�+���Rt(��)!C�wI�I������������R�H\4q>��>������M��������N���M%(kD<5BB���c��_�(TYgOB6�[�9�}���l�<���R-�*�3lJ��M��v��H�e"	6�9S�Zg���&�tm�]L&`G��h���m|s�����%x:cR��YK4F��m���I�~��C<�'g���m�L�rd���Wy*���u�{K�!������������$������08	&LH���" x,?��?�E�prJMqp"�/0I2��������/m�������Q�<�"�!0�Z^^$�."����6��%���x�B��������wz�w[�<*��b��o����d<48��(����o��.q0�� ���r���8�t��Vv����G��A��L���_6�c���	�3}�s����R�]"�����QG��%T��4��)����4�fWH����������e��^��s)9���i��}!��5���������S�h������O	���B�������e�P��_T���-�%��nz���S�/��!��K]���b#)f�{����I�B��c�o)��F~�����r�e���Rs���w�e�_�����]��������u�8�^��rr�Y~:�]�F�1m���� u��HnR���N$W��^�o��=��uA�w�����H��p������]����s���;�mM���Db������BE6��I��!e�{j�]@N���G��<X�������Bs�I/��@��y����>��~^E%�;.7^�cj&���hV��$k�Q�����c���q����".N�	$���D
E�p80�sF^Ne��Y�������e�m�08���C�4,�?CM�����
UR��2@�%Ul�V��q�$�H�C�����D�?������q	���`*�&��<ak:��na�Q��DSy7��FY���}�?ht�=��f������T�n���r�����\��m;���(�d�
B�|�Q$,���u���k�/$��?��W�������2��#�j[a�wh���z�4#o-�MQ��=
Nh���IB�}�U���� �s����E!�N��?�������P����(�'����mV��bw��J�V��~H�1���d��t�~�����1y��*G������t������Q�����������}���[n���/��d}g8uu�H�M���A2@����)�C�_;�N�z���[�l8R�%�o43�*x!M�"z�Q��X�'#�8x��i���t���VLP�.�S!%Z	��`�;����j��b;0���4��%�)l<LQ�t���kbc[|�+b�~����l�/$
����>~�7��������!$�S%6fL���%���������\D�`���;J<$����������/�@="l�l�_��j9$,��<������#������CD����S\��������^=h�^?6��G�jN��v�D������@������OvzjX����1�;U{U��S�`qD���_K�>`�OiO����C�!������"�c#��L�����c^��;�CB�r>��E�;�=i��0�d,]�G��M\���T\��vd��q�	��Z�s`�P��3T��D�[G�H[�c���r�'y��t���qBQ��z.^Q����S���p11����&����=�bD�J��LKY�&>��u2@��jS��	$�����B	b8�#c�	��|��D�INh��2#���=G���z���t������I�����������DD�`�5�+��T������r���NY�����t�����x�[U���O��K�)��w��g�6Q�/�C�K��a	H�����[�H9h(fr'Ti�)�	��)�}]��l! H�{������#�:���?"G	��8��������n������>}��]=�P��CV����a��`�!�!e���	�8���
FXU:��"@�n:X5������d@�`���"Y2T��:B�8�9��Y�G��T��&����������8C:+��X������-y�a�Bx{�;�������O�RTh0��������
T>�=`B���S�������{Sfk�%WO����R�u�vUD�.S�H��������u���b�
��:�%����l��d��NEP�8F��~i�����D"SSh^?��i���d���xp��s�I#�$	�������	��Q������j_'���M�z�n���(C�Q<���~>��xYcL0�����SnO*�>�U7d�\�fJs�z
:cUPhQ=�oe}�GRq2�F
�00��'�q���L����{�����@�B}Ke9R�z��$�>�	��j�%AC�U�N���-��B��^�gy?����s�����Wk�o�G�&��,��b=�Yt��w�����m����jv���	O�]��|M���HQG�b���2
�0fi�F?Rm>]~��@7!��		uHh�z\y�������El0%���q�	 �W{j��C����0i�%�2�mz��o�d�:�����3r��Z����A��k�Aa�#ii�9)�f�
�� fL�,0`k6b�E�%h��R��!�1tMS�YC��Z��Ep��K6�3��pK�eK���d�C��MH�jMZ+��;Vik�������@��I�$��(�G�^\!'��)��}����������Q�?���8M�����s
�f>�Ha�q&t���@�����Z�P�������!A��p�L��}���!n'�Xxg�������y��"���=d�I���"H�opv����AVR���9�hg�g�� m#9�����'��K�������p�Mzb������T�C)Z�U9-�<��f������(P�4,��R!Jk���A3������i=��@��2�}�q7'^� �� -�)9�			����5����2o~����,������fS-}�K�c��� m�*����D�Rw���[md@�w����c�Y
�J�`�=��DC���_�g��f�1����& �Dl�"r�'@�2�_
/�7�0���l
�3)RC2�a4��$�I1$R{
H{��{�o��9�\�*��s���Gr�0�~"�mi�����2%<C�6��l�x���D��^u|���X��@<�G��N�n��e����C�0�����'Y�C��Al� ��e�4�L�'�`�O�����m��d��r@�p��i@XI(:�����w�j$���.��s�M����6�����[��+��B+���\������0�5L
�n��
��/�d�E\&�#�pD�/9H����Q��e\:��!!���I�:u���3es*�(��"H�H�P��7�l��[����H^@	�un�jcj-�5�&�n9+Dw��
+��K�Z�I+[?���{�����70���B�@�d�"�E�	v�0��P!�����@�U�,�G�:���X�E��� �# �,0�H�K@��t����R�:�&Tu5����
������<m�R���-DTg�%��P������p{% ���L@�j
���������sYC����He�`i��7�$t�R�[(��1�Q�\p;2MnZ�4P�,1")d������1��	�h�B��V9&�8hJ��gG&�*��1�q���S���!��Y7pLa�S6�:0�#
�G����7�h��ek,��a
\������T��g��M4����2Q �%��Jd�������S��M��W���}��� N���'�������Y\4�bk
n�5|�,��5}m������V��
u}�O6�d����*�����������������jf*�d�a�C7�\��\�e�%�C���.$���mI��J�CB��5������6B�u��HB=����H���T��h�c�8�c��1?2>��nQ��/��Q��-d��H��a01������\��'��f%-i�������\LiQ4�9[�tE�n0-f9w�/�a"���"�$��]8���$%�zT������g�-��������q��&sm��	D��������g2��x��A��F
V����3��CE����q~<l)�x��(<�:��,&���;CZL������u�n���f�u~,���T=Co���;���)�&��KW��]D	&h���5��71�FYr>cMYI�o���>���9�}\���K�1bd!&��a
1���l
�`�����a��l&>'Zq�|IX�����,;PR�L�<�i�h�Z\����Og��l��Aj-�
�NU�3JB0`������"�lrE��%������QLa[M����X��a����
�\�����]�-�A�,��[���
���2�a��1(�O���<f��)whL�{gF�
Lh
bZ-���Ik.�F�b�J�l$�����T�#�0��s��m���&� R����0B��0�;�	�������"��;�����q���b]��qEX����9����4A��E��]�� a('#/bS[M�U��P4�d���L�g Z�`SE�����:;,�1`�8L�X��`u�����h��k�`@l�r4 �om@��z�mn1
R$B��"������C x�DV��rE7���n�U����|c\���]R����H�~K������4�TY���jN8H��������+8���m.���R��\��u�,$���J�rCP��<����Z����t�V�F��{�d���)��h2�m��a�q`�4�I3�7@.�giI�D��G�I�RFd@�rU�,�i@4y9@�:����5?�F+�!�j"�&�����M�T5Y�U!m#Q�Z����u_��n�8DI���>� t��|A�~X���HaNBb��g�S�r����Rd���0�2�ecAfIg"����9Ghk��������,�j%w\�=��&��9f�#�D�}�
N���
�7�F�CJ%V�%B����))�F
���h�@��!��a��+�/�,�����R��(Q��X�d`^�@l8f3��D8�C1�����_�5��B�������x&R��8�DL����G���3������f�����I��*dKP�C�w���o�����g[a	�x�?�rt�h�d��b\C�Hj�;f�>�W �����������o}���+���y�w�m�J��O�4��%��Nhj��;��)��F��@����	K�0������8$��s)sS0(��9,3{"e���G=��� �'�X�V��&�<�?<���r���A�+H�S2�R��a�K*����j����l
���U�z0��2I��������������O�Z]���{��c�������sn&���d���_��>#�jf@��%�a�;��.f`�v<�=2d��5(S�h����R�m`��U�6������d���Y!z(������we���2����6`J��a@����H����p:�� @�!7`����w4�*���b�h�P�\�kG
�0�mu����PV��Pl2a�I����E�����[%��u#��F;��eD"H3� �g�[��Ia���/4��c��AT�|����4f���
b���;�O@u+��a�H"�k�g^6�8!���I�0�����*E*DH!���J���	�+�$&��H��8�h�BQ��kz`+p�~U�
��
>�.P��M9�����9�8��U�9e��p��3�F(����)
��
(�GM���$i�	<�<E��T��x��o��	�Q�@Lr�H�E$TbH��6��Z���F��bq��N�ND�17$a�$	���_���e������i�	C<r\%���B���6�PPX�d��g2jY�a2�s���ks�U�ir��� ]d=��a8������q���5+��++M��Z��X=���!����*4�]���K�y�<[����W���
Vv��"9!��q�V2.�
� E�$E"��6�i��b�^����j�Z6�E%��F��������Qe����(I_�A9�(fJ��f=V�G��`�*^J��g]��@��H��p�!#�@h|����B�x��U���89���"2`��A����\���H�O*���"�C2��y��g
_*��'�!��/-��Y�K�5>l^*��Z�X6E���������6�1���w�}�r����h�_��j`��TI��9$/u���`R��j�G����o�����
����SC �",��"�N�����>D~��������RfL15��" �}xyz���)}}�a�52���9��_�k��/� ��P���J��RR�mK!���o�*��He���!"A!"@7�H�Y���od�T[��U�o��k�)��Ov���C�BAj�x.d�)��(����D�icq(}�6& ��0z���; ������0��E
��N��5*���_]k]�.� pr���2R��ba�Lb��[kX�:� k
��X�~A3���#p�-!� ��3��L�vLV`
H%�AT���|��UMK!j��:�?c��PVk
,�V*�
!D+��#�/m��
���^Kb1
�#��$;HM��@[�5�?�}��..���f���R$�|��,�l�%���H�A�@����w�om�Xe�#B#"�(3�Me'���4dw�*����3WJ7���Z��#�K�98�����!q"�mA@�'*^��Pb$��
�02���x�"�$��X�jHv�������w�kt�e�I-!�����=)XT�Mj�hk�G��I ������� �1�@�=G{C�W�Q�)����WK�VM�y�����4�z��
����?��'o���������hR�7Q���������#4'��@��$wD������@�g�YmTH���D
q���7+�a���T�T��fP���3�}w���ei�+�eP��"�M��fe�$���I������4PAlv^�{���!�c��!�u��
��)��w<��hD�i�Ph���%[������$2MF!!�u�N��Fa6fn����
a��P������0��� �0���NR� {d��������a�Z�Jm�i;��`��d�H�8���Fi�������N4f���kVei4@��Y����U�,�|d�bk��h3i���8r��-2�������8N��MZ�8clTH�W����a���X��d���_Y�)>�/K��Ob��������e5��x�S�N1>���(�lB�$�"�������s�}`�B$�G���FP��BBa"��(T���m:����S$��$�8�"r�UY".TH�&X�SeJA��-�@�d+$��E�]��sLA�BIH�c��n�j]^m���Sf���a�`��n���V�3w\I{���8�-)ar�q]�$b���UZ��j������r�?��L���O����������@���S�KA��7�h��s�����QD�m$�������MG�)<�v�D�
��/�n}Z��<���J0V#�J�f[���1�Am
t��(3��0Q���0��K,0�!J�)��QhL@�z�)��(�!Z���W]q�Q�-$(�I 
@��K@�r7���$<���5}��B�����L:�q<���#�nj��>9C���	���6�a�C��)�btHJ����&�m]���b�d�A���
�Y3F��4CIX(Y	����j�d��h\��$d�z��(<`�RAi�-���l�����p�`����t-�n��h~Cw��_��z��FF �`0�_�h0=���<|<r��=`}�I��$��X��;�9��z��gU
��D	��]�@\���I�-EIj�SkySl�i��Y
�!��XCIT�9���y�P�	����	)N!�TC�!�i-r�;�{zF���M�K|��wh���!D!&Q�S�7la4��	��1M
aX������3�=���f��A������2a�Ce���$s86+Gdh�8�xV`x����1���K>�sI���E���*&���e���`j�M��8
����!��E�O�*N�w1$
�~�HrH2�Z�C�2���#��+.��%�Z��P�y3����S	o�!����N/����m��F�vC��4���AcCpB���_�&/� 1��Z_Y�?���;�{�	,����eH>�(Oy��4�d1�Z!����c��������l|X�6Z�����!���JH�A�Su�`&qT.)dGH`b5��E1��O&���<V���UL���%�x!O
v�gt�k������(��XDb�V�`�n�����=�>��q�d	����JR���5�>\�����N��e�#q�c%�(��z5&���h5�u�/��Rr�<�Q�JZa���De�L��{�t�S
2�0Pc�xj���M�6�X�6�^���2��Z������K:h������`�����I�6M�<&�")�X)���y��'�U#5�5
HEb�U�X�`f��c�&��d}�!��4���"j�b1����Y%�������P:��v���pG��9E�EH@�Xv�]�n(;�r@��Q���l��QJvQG�!GS��9�{D�	:�nPf��c2�J]���`��xq�8s�ok3�P9��nB�PdhP�@,������#�v��L3Zv�'�y2:��wp@�RL�����Z@�B���c�U���I2x��)�08����+h�'�W.�����oMM�,`���Y�K `������Bq,�<�wH��D�L�2���� ���=�0Qk�Rl9(^
>���
\q�q�C����}m#	�+��l\H#�=`�!�.DrK�E�(�5t������>� ��|���x�2�}A!��J��1�	4�� ]-�-�1�:�RFA*3�)�h�X �`���+�M�����uq�.�d���P>|����8�[� I�7�"S;�L����<���Gf��-�4MH�6e���Bq�/����0�MV!n@e�K�c��>_V��a$�JZ�Zl�Rb�%����q|�j����&o�n�ZR���
3m^��u0�`�k�U���{�-���+GJ��9�����[MBd8�e� ���#%��[,<��[��Z���[�.�@������=�����9�������PR�y����~9��to3�h��SG�)��D	&4W��FU�3�g��d���ap�������H)����f�7Fl�(��X��}\�]s����YJ�X����9L��uK\%~x��2�:�S�92���{p-�Q����J��������)���)��*\t����!�c�X�g10�C�AT);��V��q���,&���t;=��;!@��N~d��B!2���2��4v7��\.�;�@�(���{�<�������;���;�7c�����C}��������|��{{���R��T!i;�����Wrwf.P�[���Z��M]`fR�L��BM2D!(�}I�!{��w@�;��D�+-�h��r�
��0>I�>��$3��#" �2	�
&�y��T ��C���8�<S����f��bVC0��o�j����n���Abo<&;&s����SrJK���7�+��[	�+:+h���i� 'b)O.��E(
�,@N<Ta1x
m�pK�[��."�@�J�����P�����y���&u���2���p��T
�Cb�\���Xn��N���0��f���@��LV7�1k���|o��,�G��W2$[����c&���-�PBA2�"s0�*
0�T�����\U�w�.��f��Zf�s�������^V!cbB�xa�k����&,�qMda��������_K.CDR�s8�>9�����7���va�8o�7�f���z������
l��uB�:'6�F"��������gm�F�Z���U��F8"7�fZ�#���f~���4��sZ5f�)���\�f3]��!I�w���8U�7��i�:���:��]���.�q�88�n-	�~����n2��*��"�_�.v&�����X��n���d8Y�v���uN������r��v�X��B���#���.�,�h9�f�BdD-4N2�+�[l`��
�v��:}�C�"���2%KD�!��K`�R'��*	��t,���V*.n�����RFk��Gy�o&��7��f����2r��yCt�g�4Qlk
5P�UWV�xy�t�%�PTa'$��eZ���R2V��EV�`h�l�3�h������Y�#��ja��Y2}�'!ht��,s����
��2&2�v���� N�����>��7��T�:�#��x)�����9��������<��EY3���Q�J��r�����xKNUFW/������b�
0�<�:����&m������Y%�a�1@Zm�y�7�;-]����(�LLX��Md5kS*2�YWZnE�
����d�Ld�# faD��iQ��pmB��Q�HITX��w��9��=(j>A�V� ��	���p ("�	h#PY!����I��HM�2An	����UT��2�w��\I�y�L��VsU.�4h��E�:7(P��\5: ���P���`VDA����������\��^I�E�+�
�0���b� ����� �cy��L��o���el�9������O;��7��j�-M3��1L�r_��?�@0������6#������=74���^�{D���e�0@�A0/�����<`����$M�����HA�$��R���+5��+4b&����^D;! /�	�@�P�`�X:x�^*�16��!zE�S��47�m���8��z�&��'�����$�M��fi���f-�Q{>;#)~��q�cNP�	����������	hT����o��Q��I ��Ey<I��,������l�R��q���b� @Q������'(wI(�e���o�B"��34�cW�#��&�(-�i0���b/�5��"��%-�:.8}tH�d��80��B�i�s!=LU���[B�X��!�7�����
��F6����w��v���IM`"��5���5&�e�f� !��9?�aG0�`BI�F�S��\H&G�>OYtK��>{	�����[{���/��MRL�ZY�l�*����j���{UF�AJY!��{��n���ID��Yohr��p?�����B�[����	)d�_0��$��iS32�A59������&�W:��6&$����,A�a�)L�#$aO����R�ac(�u�c}|H��B����_�\�]������2"��ae��#�R�(�KL��,$� $"����N$��
#3Robert Haas
robertmhaas@gmail.com
In reply to: Bernd Helmle (#2)
Re: WIP: Automatic view update rules

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 THEN old.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

#4Bernd Helmle
mailings@oopsware.de
In reply to: Robert Haas (#3)
Re: WIP: Automatic view update rules

--On Dienstag, November 11, 2008 23:06:08 -0500 Robert Haas
<robertmhaas@gmail.com> wrote:

Thanks for your look at this. Unfortunately i was travelling the last 2
days, so i didn't have time to reply earlier, sorry for that.

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.

Most of them are caused by additional NOTICE messages or unexpected
additional rules in the rewriter regression tests. I don't see anything
critical here.

- There are some unnecessary hunks in this diff. For example, some of
the gram.y changes appear to move curly braces around, adjust spacing,

hmm i didn't see any changes to brackets or adjusting spaces...

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.

okay

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

I didn't see anything like this in the SQL92 draft...i thought if a view is
updatable, it is, without any further adjustments. If you don't want your
view updatable you have to REVOKE or GRANT your specific ACLs.

- 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.

agreed

- 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.

agreed

- 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 THEN old.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.

I'll look at this.

--
Thanks

Bernd

#5Decibel!
decibel@decibel.org
In reply to: Robert Haas (#3)
Re: WIP: Automatic view update rules

On Nov 11, 2008, at 10:06 PM, Robert Haas wrote:

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

That seems like a deal-breaker to me... many users could easily be
depending on views not being updateable. Views are generally always
thought of as read-only, so you should need to explicitly mark a view
as being updateable/insertable/deleteable.

It's tempting to try and use permissions to try and handle this, but
I don't think that's safe either: nothing prevents you from doing
GRANT ALL on a view with no rules, and such a view would suddenly
become updateable.
--
Decibel!, aka Jim C. Nasby, Database Architect decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Decibel! (#5)
Re: WIP: Automatic view update rules

Decibel! <decibel@decibel.org> writes:

That seems like a deal-breaker to me... many users could easily be
depending on views not being updateable. Views are generally always
thought of as read-only, so you should need to explicitly mark a view
as being updateable/insertable/deleteable.

The SQL standard says differently ...

regards, tom lane

#7Robert Haas
robertmhaas@gmail.com
In reply to: Bernd Helmle (#4)
Re: WIP: Automatic view update rules

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

Most of them are caused by additional NOTICE messages or unexpected
additional rules in the rewriter regression tests. I don't see anything
critical here.

Possible; in that case you should patch the expected regression output
appropriately. But I seem to remember thinking that \d was producing
the wrong column list on one of the system catalogs you modified, so
you might want to double check that part... maybe I'm all wet.

...Robert

#8Robert Haas
robertmhaas@gmail.com
In reply to: Robert Haas (#7)
Re: WIP: Automatic view update rules

Bernd,

Do you intend to submit an updated version of this patch for this commitfest?

If not, I will move this to "Returned with feedback".

Thanks,

...Robert

#9Bernd Helmle
mailings@oopsware.de
In reply to: Robert Haas (#8)
Re: WIP: Automatic view update rules

--On Dienstag, November 25, 2008 23:43:02 -0500 Robert Haas
<robertmhaas@gmail.com> wrote:

Do you intend to submit an updated version of this patch for this
commitfest?

I'll do asap, i've updated the status to 'waiting on author'.

--
Thanks

Bernd

#10Bernd Helmle
mailings@oopsware.de
In reply to: Bernd Helmle (#9)
1 attachment(s)
Re: WIP: Automatic view update rules

--On Mittwoch, November 26, 2008 10:54:01 +0100 Bernd Helmle
<mailings@oopsware.de> wrote:

--On Dienstag, November 25, 2008 23:43:02 -0500 Robert Haas
<robertmhaas@gmail.com> wrote:

Do you intend to submit an updated version of this patch for this
commitfest?

I'll do asap, i've updated the status to 'waiting on author'.

Okay, i've finally managed to create an updated version with (hopefully)
all issues mentioned by Robert adressed.

--
Thanks

Bernd

Attachments:

view_update.patch.bz2application/octet-stream; name=view_update.patch.bz2Download
BZh91AY&SY�U�n:����������������`������K@_���2�����e���7������=n������n�������:(��%�T�="kl�){�:���j)D	'_GN'�����r������9<�����rA������}����4�]7�����}�s�bO-*;>�UD���>��wf��O��3����w}���(:�md������������zER����Y9�{&�lg`i�����K������v�z{���]]�}��}6���d������]��KK�r�]�T5�#�X
�Z������T�=;��S�������]�^P
N�v�(��p��u;�V�������@��M�4�=0���&D�@�4i��JhDF��=@��"�(ze�

����&�$@��
i����zOd����SM���y@I��"�D�yH��2Phhh4�D�M4�M&�4
bzi0MQ����j�OJ��C&���M�H�4���FS���6���� h�@����l��Cz�E!	x��W��+\a��d#Yjm�-�����ia-�cD[��"�H�(�E&f�ZZ��Z,�mf��
��?�"�>�
?l	�Z����m��/�"Z�P�-2� ��\[����z]��4����Bd�!2F��(�J�����e����=.��)[mF��G�� ��z�T��}��d�24�f3I_Ku���.��6K&���N�s��P�1x����d
*(��A(1�&)��A�O�J	�`pI�	�K+e��IF*i�T����75��^;��8l��wed���@#FJQ�F$ ��aR*�Q)0$@i�Zj��^j��k5RJQ�����L���x�x�^7WQs����CZ����#H��Bm5-�������4Qd*M{;WR�l��MQ����u��i��`���F�cFjldFSR�4�d��1DhZ�W������������+�MK)Y�����%�$�%�m6������EY%,EI-��c�Y��D����&�@"�������Y����m��o��,�$?��R�]�03��?I��o#����
���M1��	C:
<=��]9	����������>^dDh�2L�d�O�q�Zi2s�}���>A��a��=�����a���.�����vJ�I�6�"�=��<����jh�2�>��>����.���@�8�s�e�s��H�h����c��?����o��������f�x�%�\a����;�V�i<'1�m6d��� rS#��-�/O�E6.�9�z�����Mv�'�9�-O���W>��JM3�^H�f�1��
��C�����v5����<2���|���ihh�����L� �.v)��P["A\�����O�R���r%G_�g������`?O�}�D�?���F������7o4=i��a��Z���\>t|��S�]���Hw�������[O=O�����Y�X��(�����yz�n��5T��M�'�7��N�%�����{��.�����&�����^X'���`��":�����x������r�vzj���z������������������2
+<����9����6\���UL4��k.�e�2�:�.-���k[M����:U�����w��}=��9������RZS�L��q$�����UK�a�o�i]�gA����ZuIv�S1WM�EN��q�5+���� �����*e���Zs�_Rj���:���P"�F��SU��y4�q�+�R���G}s������g�*6���������E>w����5���Ax�f�B���Kf2T����1����V !�L�9mw��7h���
[��"�(�u^}�W�\�����bW��*��_��$��T�!Uc��`T �G�k��sW6L	e��������*��EFH���T�����@Y?k�r�Z�+d�x����B	����])M�������g\�{SrA�?�����y|�.o�����u��4�6c��#�#�KZ!�C<���ky�<`����<l��h���V)�������
�n����,-4]�����'DL�{��|ynZ�%@iS�y������0�*�����w9��~�qz��
_n}�o�dU�V�T�k%'i��}$||�/�_���T$	$4!���:?dI0md�����:�TWd6�U�a�Vm~er�vziV���(��8t����'��t��K�v�;A�YO����������r�[��w�H�
:��i5���W$�d��u�+�-%�)6�1��5r��,�m������f�.�v��i5�h��I�[��]YKk���[b����7uk�sIq��b��k�n����dMm.��teiFm����n�Z�����+R�Y$`�"�#FH6�3N��hJ$�:m�i�^Mn��(e�H��%��-�Z`�E���
2iV-M�����v��u��;�7N0�J���'d��@��M�G�[s�
���w���M�^��@��!�������#$�CtSO���s��-��i������;��)E���RR��<i��Hi���,g&���2K������<���>3���A�h�����\JW����m��C���z�_����v���O�5�O>���
�cK	�8om�������7
�c����;�~���A���k�A��s��&C|�g�e��aY�y�}�2x"8���J�!?�����6#�����$����b�r�������}/��z[>�BvC�W�^7*Z{�%R-��F6����?;�[�����a�B���e��m!�Ih�|����2b�<4�Z�,Ye�p5
%4�����A�p)Z�kaDB�4GP������+�@)�=�Qj��A�t��,��;�06?�MH����P�]��]w��o��w�=�B~�����Q��x�2�N	�BeG�_a����9BC�D��������tl4&Q������y��>V.S���X$S7/A���0!Fabi�	4I$�@>���
;V�v-�M���{�$&,L�qa���������q�����H�,�_�Z�9v����@hu��8F�:�B�0�M�vww/#�����?t��z��M��������L[�5I�3�A�o
��@3�����biB~n�����Z�E?���I��(L���4]�'����v
xx�`&k�`q�_����o-�Z���Kl}�29 lTJ�Rj���e
������Qe*����n���h(Eb������72`�1Uj3���������k�v���L9Q%q(�* ���?_w���'�!�?0T�����W�z�E�\���t��9&&�Nj5X����-E����������������|>�������#��/��FK�������ytB��}T��~����=��,���x]��FTT����:�|2��+Ba���V�s�s�D��8>�h�"�Y��S����V3�<2�M��f���?� z��-�EI�f
F�G�����d8���u�u����"f��S���r��d"b/����C�f�;S40�x��yu�����������s���b�D�kZ�lj����X�5q�q�"�����&����{��G�<���}���}��S�����w��$!uT�,>������<<���g�;e�^����OWq3�]0#��{�9�I:��unt4��m��j��rQ&=W��o/J��==w^~�or3�&l��������a$�BI$�����
���wI$��w����F����YZ_�"��z�<��%����8�g��?C��(�u����4:�&K�t����#����N_�`�o��f/�W��np��]�d��t��fWU��8�<��E�����4��!�(��8�}?_�_8�������:MP�(0��\��PKP(I���1/
�A��V2���%e�8q��{�]������������(��
����
mb�~5�uo��fA�	U�|SB���m:\�Y��qT���!���Z����=�OeH�c�Q�.��y������Z��=/���i�1�#M��m�~F�$�V
��������*��$%��bm�Q�~�k77���[\B] �(�����X}��J���������B��@0=�����������]�&T%^o���.5L�2
 ��Qysb����u*������@��:�w�5]����q�
1��ZR���rE���8n�&��C��<�����!??��w����[z�L2)��t����}
��m\	��$�#c�����$q�����Rw�'b+�v�6����E������lE(���Hs��]w8�=�bzS�z��9�
��78���y0�!$��C_�""GHP�],bE��V����h��=#����U�y$��@u7
�}D?/&��v�S�F��������4��C�
rE�G���=;��y�#g�e7\�
5s��Rw��(���O��g��I$�H7��&��_�W��j�vF���!Y{D&p�?��\a���rQ&����D
b�|<?���1�'�`���W��jI�f[^�����������"�.��a���y�v�%9?��U�l�����{�N���R�f$�|<�����t=y���/���	�"���D�?��Dmn�tChm��>�g���o~�����>�������a�zA�_"���T�RLDd���[^�����z;N�=�����a�]�D*��%F�0���]C��'�'��e��~V�2�w(��~�zH���T�dDSSg]n;��Zp����gO��pyI�[�����)�T��HB���i�n;Meb�I�����y#�&�\�<����H���8���$��*���M�MF���/��f�hG[S�8��R��s\�F'j��b���v=���T3-�1x��+����U��[�O4�P�����>f`N<s��W����:�����tff�22Ar6�6���'�H���0�|�XN�8���p������MO[j���Tw{�i�/Y���[��M���.��N#x��k��Q��l�����_V�Z ^������Z��1g������L�@����^���k�W���H�;r�Ik�<n����Us6�UT?�z�����uZ7_�$��f��
�C�������C��T���Y��
���UK���<�����Z��7~Rr�[������2�1�"C�`*��tcW�q���
�>��'m
708�zE>[��w��G����h�D$����Q
aF���,������r�F���&��������t>u�U�?
D��{wqVk�\�&�&�<����
���m�
�z^T��l^'0��L�y1_��c1���������|$�u#�@�X>����G���S��>F�.#��l��.�v�MseHWV�m���p�ZN�^_�Ev����'�Bv1�KY%��f��2Bi���B����yJ����DL�����	n��gLu������3f�F}\.rG;��t[�1�I���kv^c��&��Z�2 j#��t9����*�����T��3FR��o�����6t*��xZ�?��R;k2D�����F��a,����9�m�nV���`���$0��m���SKq�����1��Bd��B:vY�si�%�������hU�I��C.� $�y���Pi)h�7�J|=�
��������.�{�,'�8J=�?a�N��+�F��	��Ua!�����f�D��:-�x�����a+��m��W��m�����Z�nZ*��o��������_�qN62|!��m+���I�g+�V���L�v��,ug\o�_���V�����y���-y�}5�km� u�1�iVa����_nA��cP���^�;8S�����w?�a��o'S.��Mz�F�	���hG\lM����CQGkZ��DbP-�7�*�\Z������;=K�����^��Q��Kb��x�Us������9��D��~��������n�2R�3�U���C���Q���1z�D��������Y�mU�3�0�����9��*[���f,0�a�A��.���/b��BN��z��;g����K��^{��q��W�E\b�P{"R��b�������m�na�o/g��^���t���b�|��
q���
��
A2I�t=V��q�,^8����,|,�1��� ���� ��e��q�si���;r��!d��a*�s8�}�����L�-�3\�8!�+[U)�1���<����{ZF����<_C�:����e�j�g�����j�����/\Q	�GH��}����y��'��M�I�aTa�0r�i�$q�<ty�>W#��V*���E� �\K�*�w��o������U��eZ���M��:g��A[du��dI-m�����w���^�Ic'�������
��n- Tk�������
!�=����U���Jt�l��$H�6���uXjm&e��Z�Z��A�Qq�X1S�_;�n\&���8f���\��BK~�F����3�����X�]Z��.N��B;hLz�s4���}^�S	|�����8GK(�r���EY��x�D.L�����M�����r|�����������n���4k�����j�� h
\���C���������+5}��}gr}	�*��+f��T�����CA��UUUUZ4A�AGO�E��DA8@�ov
(B-����#�qkm�8L`���~���e�/g�a��U.\��tK2h�r�����U�n@i�UA@���7�/9j�����A�����D1���k���y�K����A�)e����E����k����Q��Gh�6'37�x������DB"F,�M
�@i&P~���?�nt��}���^	!�9:8�h�A8�70��z�����|~):a����h@�
�{�d�\/y�n"d&f��+;&j:s}Y0u�'6����:II��\
-�}R�����S��!�&=R����P�z<
:��O5>UgF�����0��3�
����B����y`3ds�U#FE��C;�%clj��K��m�{���6�L6S.�=n���2�������F����^\����q+�<�-�(�
5��iA�LbvK���z�;2�=~�������:����|P��?�Q���b<����Y�����fv����U��o��F8���*��'�2�����{GA6z�%�1h�������h�����<�]�5��7�v��s7��EF�����%"�����!�Z�Y��������T���n�8���Rt�N��������9�"�s�S���hvP�S�U=�?��x��0�;!'"	��������
���:g8N&I�j��7�=�Uw%|�5N��P�6�t�:4��(L�<�.V�$i4`W-x�z+����Wi��n��L�jG���*���d�1����t�$
}��p��l�����K�;6��HA@��)�.)$<�0t��J��O��v���+w��=,��t�Z���C.�(�l��meC���Cs�e{�3��V�X�Zl�F�3>;����s7/o�����4rp;2f����6��>�6����s9�e
�����}���^�b4���*-�c=�����aY6����~$J�����ldof�e�K��B��Z�JP���8������7y��,@�6[������L���3����x�G���j����x�o�xj�A`F/�ESlUO�@�������'�v���L��{)��%�RZD��'��B����s��H��W��R,@���B�����Q(���{z��	�^uO��B����2D<�#�\����2��%��d�a���(?�id��8TU����K��Y:$m?����L9�������������U������S�����\T��X:�����������^z����U"}�Q(�9�1�!���V�S���gSY2y�"SR�^��W������s�����_��U1"��"1�����)1C��A���5;)��Q�D���M�A"��Il���`�(��I���
CB�C9���Vr�q�lMs�s�=��f����q��f�fI,` +�'�	�(;��
�'�O.����������M����y����J%n��$Cbc-R�I�L�
�=����Q=�����~��U����B��#���I0I�+e�����N/����zX)������
�������>q��B����4|+��M�@��XLG9������E�<��[KD--z���*��@������������;I���R�NG}��v@�D�c��'��?}I�}�h8���Y�]n�h�;����Uo)�GEy�
H�e)���JT��Z+9�!$(�E����~ni��>��U��,~��}FYt�?%��&�mG�r�
���0����K<OQ��:�QEQ��y����IdS��o$����G&���_No��U���N��L*�����	jp�4���G<D�7�8D�����k{Z���$�!��n��W^z,�{,�D����4����Tc����O:�����|��I�����d&�E��������������/[<3�8^:���A���.A�BH\RCw���]���:w(�/|s2�}}nR[�Fq�{Q	��s2�10����y��Z1������*�bj,���G_�0����J3��|<��u�J���C�����U�9��O�������g\�[D}P�z?�a���������#]X_�-��q.������:�\�8�����j��G]�	�I��E�KJ�gv��Q�Ll�l�o���.�mQj������K�Fa�%5�d�/��������5
��6���o[��h�4F3J�5�b�Q��,��,�R �JJ,F1$a����n �-��j���F�B
�(">�9M)g&�"O�I����(�?S��}������-��c[.:kA	$���@�Th"��AdE�D!W�}�y�P��6������y�	��|n��s��.����H]H�a���@�{�?$�&s�A/��}��e����F��������o�r�d���Ce���T2l5��$jT=6����/�u�&�->G)}C�7�<�6��� ���k�����]�%E���O�%����=�j#��9����c�V���l������BOW��l6]i���"��K��TG_��9����8M}�����p�^]A��R�*������%u�������Tm���3���~pCSo��}8e��M���������K��~;��*�e��N��C�Sro��I:!>�%E��c�V!�5��ln�RU�'�M���2z�Z������a�q���C��^�
2���[�s��1��`��FE7�vT)���}Z���(l�a2�t������Jm_�NS.:K9���N�C,���/���"��H���)/�&�$������E�g��/N�����n7���4<��x�
z�F3����*2�4�������Z����O�P
4H������[]*�l�IH��dC
�V*�$#��)���w��<��u�,k=(V<|�K���Iaw�w�_�*���2�M�`�����\�;tM�$�	� �A�%��9B����>r�l�Q���)�ecQ�N<vQPVe�E)�:�����E���f_/7��*{s.b8�gN��!�w���p���;��6t@�~rh��|_�j�4����3�|�������wh�&U��XTsPB�7+�}�v�+�:y:���3��_I�x����}�q��y���)OJ�D��h�R�*�K5��];T)������}.1�Qrl���)cw�����h�=P
c�|Z>���3sP)\e	-(�p����w�����^5u�($w����6o��r��N:�W@��I�P�kU:J�#���+t}x�K"����o���2e!#F

��.��]�x�9��d7*����5n0�b1J0`�(���R��ccC4��b�b��0���������"�P|����5J��$�*Rj�,�����\���_���������QN��U�����L�"y�<���O����_m�w���{ �m�(6:�������4��g�|L�np�<��|�o6i71UT�#l�o������@�N*�������Rp��<��`#3��|������G(���q
 ����XpPS�I�$�N��WH����EYD�� ��NCp������� �P���dA�#�(�^��|O ����`2 s��Ha�,���#���A����8!�X�	� ��'�#��i]4?��3��3/!���xE�}��\+���y��*�+p�8ov*�ah���){�����c���������T��q,��b�O���{%*$�"I�Fsr��8HPq ���ug�Y�n����gL*��Q���#�s����J��\J�l� f�x��x���d�e�R�F&b��H1J�!T�D�Ki���X���#�5�PF��J��N����#��"qB��8T�dbU���
T�H���L�r��WD�7E�v����,���G@�{*�q�r2���m�������<;�H+���B�-����������d���'��M�m����6��80��)��|D���h�a�����a��K��5<�.�-�cm����;��;v��V�������hN{je&II�xzVTS�����ESz�;�G�q���|���#�lM�Dn�I0�[��t ��"hP���I���Q��I��@�v(��8��x�&%�T�����1�5����+o	{s�n�.p��������u�_7�:vNq^\��;�m�B2A;���~��q���}l�D/���K��{���]����Wh�
^Z'�g�.����/6���;���c�S��.��z���A�A�Gn����0^>:�����C?=�� �h:�F��,�Q�9�9w��J]������SL 7��3����3��_��>�_�W�v����kH�<�]���I���i�:��������X�%�@�c�E���S��A�?�A����&���������Y��K�a5�ci�Hl�W�y^~W�������}Lo��#4�:��z"z%���e1�s�
���|�?]����9�>5��aw^*�����{�>�T���$B��1��Q����'�K�Iq!N���m1�H}l���<�UO�;'�#�'6���p��=)�Nl�a�����(���e���5�}.�$'�����{HiC�7�2A������L�����[S]�:D�����b�k}Z
��V�!�A�)1�<�z��}��r�eB���vl!��&'���Z�M��=#0�Y��2"��c�T����.��,�Gd��C��p.AG[��n�����})�DA2�l����6�0_<1�V~%���)/��&�A��QjW�j,��2&�t����]����[�F��N�OM
#FGO�v�����b���S($U�:4���80�v�/Gc���o'9��2'F��M99�B�����?����$�\��RE)U�8�]R&�����ZY�+��p�$�H��Q�<_{P�)�~g�������^�"�

��c�q��,��K<0�[�����%�����1�A�����A0PS@|��6��'T�rIu
�����F�O�D����D�`�dFik*�d�0�A�Jz�����Wd
�@������@����4�g�:���y�@�����\���$��z�DuD~���R"@�F��W����4?�o��):����(H�2?2��~���|�x>��R����������0��P����B�%���Y�D7+c��4'��9	b�XW3���B f����'� �E�U���w�F�D��@T������!5��;�-���Wh��^~j��wF�������rCe�|����^����2�2#)���2|���>��>B8A��YS��A#a�����0��,|=;����a�5�(U/2Pw�����S�
p��|��L������*.��I"@�����*��o6V�!eI��Dp�*��dE���&��X��sa��	P�D�#$%�C���L�����2��3�Gy��D��}�|>�:������v1x@��L��ve��d"4= �h��:�r�yS��
q�G�7=����#�x|`����(��b�7�C��0>� �=��a�C�����C��7�����J>��~u[V)d E�a2��wyG�>G�y��OaW
n�c:�&W�h��O��N�)��O���L������W�IF!9�OX%!t�9Av[�Bb;�T��^���2�B�m�s�;���4�jT�JR��)JR�`�;~Ni����K�g��]2C�8W�"co���!�i�g�����>:��`H9��B!�����:��}0��nG�
�9p��
�r����>p�O����`�!��g��2���X��B������1�����jQ�pG�_���z�>����>���6�����W0&���R\�W]Z�c�E�`O@3��}(���I0�����Fj����P�&�?�)�b�R���Fv�|���^��v�u����%)���b��P�N�o8�W/2)==��(�p
�.*���G�E6d������m^�
0or,$����>(�9!�9����n�8[m��*����R!b(`�9y�����<�vDX������������~�*�|$w�=H{#}j��?1�&q���#��&���X�w��a��-C]S�$P�����(�l3����@
�OZ��Em�E?�|��N������W�bmVI>#{H����E�p��a�	 ���E������0g�BH�����a�����CRs����=�z�{p8�����s
�$	w��~$���;A�B!8}#I��(%�")���c":kJ{(�� C��1_&�Sr�4�@S�M���H!��)T
N��
�|���Q�:�(*����W9F����Y��dd�b}%�\v=r�f���m�2 K,�$�B���5J �X4��H�H�j5r �.Z��}r�+������}����`��x��Oh�I	�Y�w	P_�����I�O�|j�Y1�\ajX-�����
G�~�n�<�o��b�R4PmEI��L�����������Q!�E?M���=@t�o�vf�'�Uz9���O`Z!�iP�������P��
� �~��Gg���l$c�V-j���>3�T�,�b"U�I 0j���~���BAY-�F�a!g��\XzAL��9��hI%.Hf�+�C����p������U,G�e�%J�%$��LY�#�(�B�����:����o75GP�I��'[����?K�S�T~�e�-#����C��o�kG�Q����?3��@%������'�}=��A^R&D�Hd����G��3z@����H�A3���}����P�G�d�����;'Q�(���sIa��b�M�>68�|7:|~����<�~�;Z��~	0�uk���*t���6� {�F�S��v�o�Y��+�O+%�����}8��?���0�
g[[%������~^�tK�=�]/�	-L���M5���h����0��+.�:O�)�1����r��X���$T�;��;=#&�W��~��t�Td���,�2u@4T6jF�����~w��G����ev���I��j��G;b��������|g�qN���*N����e��I'�.�0'������S�s�\�zG�-^�'<!$�`��B���(NB*jj�8�v�;q)��0�j���d�q��������(�n���q��4�w*��I$���Kx�	��#R��
@KM����v n��'!�d�b@�PQ�����������9��Ec5��e����������O��+u�����v=-���[�O9%oB�p�E��hQah�|�I�}�#a��8$8�l%��Rk���2	 ��� �7d���*��jH��[��%w��'h�5d7�K�y��h[7��z�z6��*'eZJ���/�)w"~c�	lo��P��oq�"3�_�)@��~�]_s0p�)�y��g~��`Z�;s���%���>����"'��lMw�������:u���=��1�4;�����JpRl�pw=�q�d�=�����D;�b�$�K^]u����*:��!���&N�;���%���Ka-I-����^���^�MR�E�j��-�s�s�����0�3�0�Si���[��}l��������g$]�M`��h� B��G+���#�����/���t��,�b�����JXI�d�pL"��i�{���*
S��yNTOj�	d��A��o3H<��$���Xw��V�H��j�);�6����s�#��UP�E�/�������jR��Y�maP��(>R&���rrDH���������0��YD��DO� Xh����J�����NS(�aFCRK�$,XCR�0H��P�e�����#
}�^�z
��Hc$��;3iRCr�0���dA)��A�0��
����=2��t���-�t�����"�Iz8��U�
o�I�X��}������xO�,���8(3��_��vn,z���T^��9hJ[!�o��k� ?�$�F"�Hz=*p��@��V�;��{��R��an��fM���dH�V-�~�8c��q�o;������
�"�	 
e��.����A���#�.9.��u�O�Gy��xm,�;�uN�������$90<���i��,i
c]��6�8�Jf~��M
�}'���n?+��{���M�qi�!��b�-%�?|5"0����5#*���
�B��I�;;��?�f}E��+l$)��e����O��E�q��A������H�A�6����;��YMhPX��	��V0��aW`�:d!��R�1��3(�����skZ$�����G�aT�`�
pd�R,"�E�	v����:
���K��A�X+$�����v�EC���z���L%����,>�{���hG�$dE�&o����
1GT]��R]�")�����%Q��F�J�"���z[K���(Z"�[&����!�$� ��,����(0ws�U-���^CI�}FG~��,�<�*��5eM������e#'w_����^���(���������t<0
�C�����)D��PXu����E6M�p�nAr�%��3p�n���Lw2��7G
��g�Vr����8�O�m����L9l��C���e��ULm)���+
�aDF(�ir��9�Jp�.ek,��a
��%`�w	R����m�!�@dA������nr�1;��/cBS&�ZK���lvN#QN���I���������"��;x���� C�.ir��U�#s�6�)��5�T��x�{D�{���wL^O��G���?��O`��r&�!�3&�.�[ssY����z���3d�v��P���������������=��cezv���{����RrU���4 �2!��:
������@.q� ;���&L	�Nb�x)o���S�Qp�����,zg,~m�#��#�XM�����Yz:gM7g{.�H�e3
���Tf@�L�������#,���MhB7���3�nX�N&)Q4�a������|^V
�������Q�j	�:v���$l-�2-�������nv
'R�"Y����i���9�$R���F���������p�kX#��Aq���!�73��|�1m�.^8r�3��J5\i�1����k�4Y�h��7�������A��0�'Y���AU�v���%{�Y�y�����,��f�u�?6agH�������H�����vYL�7t�Y��E��dI3D��c9M�9��.��4���6�"6�v��n�W2�����:&,L�Y��D����p�I;I�O�@��N`��lL��3x)^-�0�3�N��PHso�C���2��<�i�(����o
�}��<�{�[)���	��i��p�{q������J$`v=���d���f6��hrHi~IcN�a���T;�@Y����,x���f���UPC9�n����h�Rew���`(gL�T�y#/��LL6 ��:�����a��8�m�����a�1-
�gs$��S �@�<bP��a%6l�����9O�D�b0��{��9����vI� R����0P����N��czsz���"��;��<o��������".��n(NY�K�$�I&)$�J:��!����^
�']�����hM��9'2u#h H�E��J)R@J,���8pJ��(-I�)��ij��J�[�`fA�K�@��Eq�qdF.a�.@�����l
�.C�"+�-V��VU.���)�)$�J���\������%���Dx�:���3"���=����
O�����T"B�H�h��`��c~������5��jy����h�Z$��9��+����M~��s�L����re���)Q)XeC�d���q������:���
xu&�����``��1�Wqn��bny
�JPp,3�FAV-H9?]����C���)�U�d����*KYLI��J�d����,�Wi@4s�r�LSC��P��4z������v�bl�BC��EeM+nnF���U��i�j���5J����F���C<Om"Z����*V��b�r1?Q���/��>w�"|J�!�9�v��-��GM]Q;� l�eLd��.9PY�Y����I)��`�Y)R�#��a��~<3�q1��al�v)vu�5)b������8_DS��a����>�H��0�|���zG�n��������m��[!abV$�'|��;���FOw���\�4�
���1���1W����/9)S	��u��yJ9��1������! ���^n��G��`��O����G��/S�1�)*N��.^��*BI��~X����g��7+|7��u	Fc���]��T��v��D� ����"��Ow��k���������C��O�7ru�7N�k3`Y
���d���'X�T���m0�C:_*x�1m������1'�Vk��o�R�~���������i�
\W��Ue>:�V�C���B8R�`/�C�vN���%�\u)v��(������D����#�vN��!�0S�"`�*�m�AAMN}-H��?Y���d�2��SWlO�\,Z��\(K n"p=Ib!��yL�
d�����iXC���08��BAXFHC������S�|�~a�zS-@��rD���+�N���Fb��Hbz���Q������a��WL*�����z�u�[w����AF���2��"mIU�6���m%%I��mMV5�6�V�����]�"�E�AR���rEu$G��!	n~m��k���������
����im���d�$
��7�$V2��=��_����U�	������S�C��Hi��FV��T�[]���[B(+B�(6�0��x�����&'oS��kSh�%I���Oh�����Ub���#����� f\ D���Y<�M�3S��CEG����H/�<�dA�>�+'2�#f�4�:7N�z{�';��k8'��?���Q�m��3�|��Sgz8����%��.+�:�F�B�3�������(�$9�x0�l!�R��n�nj�N���6���m��
�^t�x�0�(��H��������������Y�M�7i�+��8�8��4�e6j,���>C@�`{���o{r����2O'S��h���������a�jK��?MW��I�2A<����&9��E$TbH����h���mTZ����N�'9:&bpH�!H)!�(�������ee�RR�ib'�LhJ��bf� |�	G�hn���x�b��H5F�X��P
W3$o,��j!�8)��������G��.w���K�����Z��[<�>wr��X�^��L�6>t2)��D9xPT�q��A�r���m��5���Q<������~�p�_iCz�l0�L�y����H@Cj�������v(h�?�U6km5���5���l�!l[$sr�:T[$��Q��"TC��1����|L>�(I_�;���EC�7���n�E�W%W��>9��@*e% h���E���h���~1gl�l�)#P�y�����!{=�<�:�X�	�����T�C$��{���?�����v,=�W�"-Bd#�1�'1�����V����$PT���-��4�+���1\����}5a��TZ�7E�p� ��g�����:0y�v1��_��d����bz
�>���j`�����Q��i���������'<�FI�� n"� �	 ���SV,jMlcF���N�����}$bv�*{-w�U&aD�Xk6Q�@ CY��^�z����"�yV���1�j���O�����5�$RV�(���]�M6��|�#����D$ 4�w�j$YUjYe��kB�.�y�,���r�_:-��*���v����D����S����U�3��NM��U��k"M7oy�����m��������Q�L��<C�'�C�o�v
� �����d	�Fy�(����iJ�_�.������A	��!q������
a��k�:�3Ip�j�Rf����sn�^C
P�H~��\���uV����,�;R������#�K!j��;r~�R��{�t��Vi+A���&+'[�mX�,h\YRO��uk�Qx/va"�[�����B�H�~^BC9!�@^A��a"�B*��9>������R[J�5fS2�BE�>�B���"5��� 89�9Y�.[�iBU-b��ih��A#e�b�VC�\m��x�kx����*��(�����I�P�`������Dg���YDX�Q���DQ���l����i&@�`Q��"���}�T�9���a�n-�&����9f��h�"��Y��w���k�)�*�o�z����?E���O��z��l�H�#-!�<��Q�������H��M���r�W�4��Rp��N��T�X�8h�dzN������t����4��(�
,�E��#
cQg�����P�D�=g8�����N.����z[�)��)��O;��`h���4#�|&�&�RH�D���$��2�76��Q".��(-���g���k��J������4�n��/�OC|�"I�F	
��d����eL�d��"�O��:4�BH�$�Dl,aZ�������,����Xy^=����a���p���i��Wd@dD�D�i�PYA=�`�#s0��a3�"��ir��>���w{������s� {8�6���N����������uRzFR���,������$��������L���0�6vC_G�F^��=,<U��)��O{'IY�C��l���QN-`��&-�8lz�l��qPT��	3d��`q[-���ZM RS,�����ec�a��q17���gW��������oc��������%m�3�6�D�5}�8d���f�`����X�>+�]o���N���F��a,�+����>(ds��#;x�E'�6P�22E�����J��P8=�`������w��S���h�8��������Y�������G�r199�84��-Z�����������P�q
�!��96�����?//��q��<���m��O�ij
���E�#��
c,�`}m��W�����!H�����e�ER*a<$�-l���mKV�b��b:�L��j#�Ss����mw�{m�
�Y��Q� �;N�$�����������Q���e�B
�UNeV�@���L�JIt<�
Na�	��itjB�l6�����w��cw��`�`T,(��ZS�����:#g�)F���=1d���!��|�������=@�D$Gq��� sp��!�v�s!B!�)L+K�%r�-�u���H�S$�l�	��:k��p�L�z:�����J"t��1�R�)�DdBRF�d��5$�Y&�1KX�����������e��U$S���G���������������}��y��L<�8=)����75N=����P�QG�����s��'g�xJk��J���?��q��l�(����b@����i���������e�C!8gF���Bf'�:������}rv?|�RX[-�>s�A�(>�4�ZD����(���D����{��=��� ���O-aq$OU�ae������_��3C� ['��OL,D��.D��^�+2d��J���*X*<��Y2���;Z=T��yG���T�Q�A��l��������Y6G'mpUQ2��Yn��*�����Ij�SlRl,�{��5a�VX��=>����h�	]]-��	6�����a�A2�����"���d��!��C���4�" �e�p���dCL&<�%�F��X�M����)���0�qM���X�vC���Z�� �A��vA�/�b��K���a�H&eSwW��/0��w*J��6h���Y��z�oG,4��P��������C�"�\�c������^���\�d�2�����
���n��c�2�5|����������8�Y��RP�g?D��a�ZT[�y�`��k;��T/�l���CF�TV8���~]�c�S�7��w�M4���DL0�J �Ke����Mb�F �����
����y1$3�����K��/�����{O�44�)�!� ���!=���S��:����������78���`�|P^�C��R�'��-����:���av�\R���L��&����o9��������U �����:����������6����������{��uv�!#J�R��J�t����>�`�GA��Bo+��D�`����@����e�A����mr:�����}������*U����rk�2�r�j���*���j���<,�x'�w$���2?�Pt��ac%�(���l0�) �f��������;!�kJDc;��21��2��%r�\��
��,���@X�1��5T�u��#l7NA���[^Q�,�D+R39u��Hm���R��M�U�t)�0bJ��@�@@��oJV�'�t��,�ui408
F0�R�
`���x�)��H�U���"�L��94�Qm��?�N�
Z��u�#>-|�4����6ma������US$��9���9t���==E�RA�*��KUO&�rr�bp*q�; ����!${�~~V�d�~1�V=�������a�c��-�vv����2����Qv[ "1"O��z�gD���j�����	����m�'5d����kFL��g�4��`zL[��L�D��G������s����H��,�>�����:_���a�j_Oo���^����r=��:�V�H�r������B0�S��i��K%�����CK9�x8���v�J���(�Kd���WF,V���^2=/�D�g����B�Q��_�l(!����k��D@�^�n BiJ��M���`z��&,��8�ce�q����#�S���!�&��_���\K!������yv�v�!!n��e3N��Fkk�@�����!�&�b2eYG�%p��l����J�r��^�R��~���������(�+Fz8
��>�D��U`o��N*��&�l�{��#l�d�1i�
=���Bny���A�������:h�x����l�0��6r�����)t�r$f�'���u{6�2	%-C-6f�1B3�R�E����{nb���[�k���Y�0e �QT��Y!�daP��
���t�$G.���1���\�� ��,�;�)��)��]������K�y���X�x������d�M0tv����#
�^�n���s�7.�\��*4|a������E�A�G���������������K���T�M'��\��N����������]�\���t�^td�T;�� ��@�`q��:.�L$M@������}|,%Z���f�TZ���I��q�;R�	_�#3��Uj�	��o�Vt�>�N��tnm��<���4TD ��T�u��|��c�J#�`SD��$&���2�����&�c�AT)<j+6^�:a/5	��}RN�g�`8�#��{M�8}J�W��{
ae����1��
��y�X��������|Q`d=�|Z����H�[[���F������e��\���X�����	���G� 6������@���G���'n�>��D�r�LE���9�i^���@
�nW
��l�����sCD����B>5:u+�Y%.Hw'}�\n#��j��b�b�qV����3�rOG�o]�P`������D9a#dM��1\3.�f2�;28�`|yG�����<rX��9:���U��*�$��jSm$�I$�����/pn��;�9>(��,4����pY�����#��)RQB��T��"�Z��dbI]+������q2�b��F�KP�!�,N i��9�hDC{_�HuW����q������Y;�	D�JYh4Ac<x(�"V1afB50��B��������R8��l-���H2�(�"L��)aaa'k���"��J�t&q��J6�p�vrb�0(K;M� ��i���Q�S������|z���'6��aJ����*�4�[�;�c�
+,���etm��P��������3��`!�$�
"4�g�T�2R�g����@^�r�%nq�)5������N$i�k1q8�Q��a��1��b f�
�>/�����M���L'���,1��_K.@DR�r��2����C�|�n�kF��/ZX!s�|;C7<Ap�������U�3y���"�i�Q#i��0���!&Y� �����`�
��o�O�kW�F9"z<|�*���L�����e�l��4�3�t�5"��e3$<:�a�23���:�&$^:-���9U-���8�&�.Z�v43��TL�[(�S�{>b|����p&�q�������N���E�1���d��2!� ��SQ=]��-��28�rQ���aK4xxT�uG2/,9�O.PD��Jc4�J�2�22
���
��a2g6����4"�-WD�+e��xP��I�����P��X������dx�����`�!���;)�	5-���1
Oo�9>a��������*	�$8!k�}���ly�ti��UBl�u`]}�@����m[;����&��q�(�����I
���.����)&$�!�)��e(�5��P��������[����"b���
����0��V�������b��$�%2��8����0�
���N���Yn�%Ko�E����f�bIZu'E�����=_S������'���64��Ql:y���7�����X��K�Q�`���J���!�������7pMbG3=����T�H
ZE��hGSP;�x��Yk��i�=)<l��g���J�m^���DAd������7K@�g�X�3b���FWo�X��x��Y���B�o�.��	S��z*bR��
�d��"`�����AlH#��ELLX�����X��P��	e�[���ma���121#3
&L�J��Rm�	
mB��QTU0��8��{��p�:G���#�:Yl,Z:�(�U;���E�V�
[�W-��	�l���}s3l�
�M�~FH-�<^����UJ�3!���n��K�"N�S<d��5F��ME�82�r�
 ����h�J�lE�$D�f]s>��z����l;uTI�FN����	��AC��v�F����=c��O����7���zF���Q��iY(x���r`������@���������A�:W��>����=�������x��*'\;�A!#$�4����^�	E�(�XJ���"�L
}�p'��y�nw� R�'j����h���M�&Ub�M�)Y���V��Sk�md~��h|<aj�l��^��I
%�W�R��=mp~h��P�^rw�~����O��9��#��f��>d��E��,P�+�ev}��9m1o0����������~�p>��i���~�B�~wl$�I"�j�`���0����za�
�Wo��5��#����:�/%��"��@����.�R��_��{@������>���9�9m�f��N�9�����j�i����s�WDE�&fk�����������1��Gji�H�t���r���%-�;�8~z%Do,�\Iwa�6���������D=qR���$d����v���|�O<������=����(�������<F��J}�0���O����:�K6�����=/O����FLT��*Oy[��z�n����MY���a%�Ii TT�������$'#������:��2�Do���=���o��s
a�Z���Y����)��,zU����}5e�R�K%�*����m|S_jW	����������r����T� ?v�x�C���������,J��&fZ�������w6Pf���;����o��9�HNT��xm���t��5Y!Q�O���t��JS.@�*��)6��JZX���/�����0d �P��9�>�ia�G���������J�"�Z�x�Q�f?_�B���WC�����D`�z=��������*>-]�s5���Id����8YbL�B�QQ�)c���H�
j�-�
#11Jaime Casanova
jcasanov@systemguards.com.ec
In reply to: Bernd Helmle (#10)
1 attachment(s)
Re: WIP: Automatic view update rules

On Mon, Dec 22, 2008 at 8:53 AM, Bernd Helmle <mailings@oopsware.de> wrote:

--On Mittwoch, November 26, 2008 10:54:01 +0100 Bernd Helmle
<mailings@oopsware.de> wrote:

Okay, i've finally managed to create an updated version with (hopefully) all
issues mentioned by Robert adressed.

Hi Bernd,

1) i found a crash type bug, try this:

create table foo (
id integer not null primary key,
name varchar(30)
) with oids;

create view foo_view as select oid, * from foo;

with this you will get an error like this one:
ERROR: RETURNING list's entry 1 has different type from column "oid"

but if you make this:

alter table foo add column description text;
create view foo_view as select oid, * from foo;

then, the server crash.

STATEMENT: create or replace view v_foo as select oid, * from foo;
LOG: server process (PID 16320) was terminated by signal 11: Segmentation fault
LOG: terminating any other active server processes

maybe the better solution is to not allow such a view to be updatable

2) Another less important bug, the WITH CHECK OPTION is accepted even
when that functionality is not implemented.

updatable_views=# create or replace view v2 as select * from foo where
id < 10 with check option;
NOTICE: CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
CREATE VIEW

3) one final point: seems like you'll have to update the rules
regression test (attached the regression.diffs)

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

Attachments:

regression.diffsapplication/octet-stream; name=regression.diffsDownload
*** /home/postgres/pgsql/src/test/regress/expected/rules.out	Thu Dec 25 10:33:28 2008
--- /home/postgres/pgsql/src/test/regress/results/rules.out	Thu Dec 25 12:38:21 2008
***************
*** 1340,1346 ****
  SELECT tablename, rulename, definition FROM pg_rules 
  	ORDER BY tablename, rulename;
       tablename      |    rulename     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
! --------------------+-----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   pg_settings        | pg_settings_n   | CREATE RULE pg_settings_n AS ON UPDATE TO pg_settings DO INSTEAD NOTHING;
   pg_settings        | pg_settings_u   | CREATE RULE pg_settings_u AS ON UPDATE TO pg_settings WHERE (new.name = old.name) DO SELECT set_config(old.name, new.setting, false) AS set_config;
   rtest_emp          | rtest_emp_del   | CREATE RULE rtest_emp_del AS ON DELETE TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal) VALUES (old.ename, "current_user"(), 'fired'::bpchar, '$0.00'::money, old.salary);
--- 1340,1349 ----
  SELECT tablename, rulename, definition FROM pg_rules 
  	ORDER BY tablename, rulename;
         tablename       |    rulename     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        definition                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
! -----------------------+-----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!  foreign_data_wrappers | _DELETE         | CREATE RULE "_DELETE" AS ON DELETE TO information_schema.foreign_data_wrappers DO INSTEAD DELETE FROM ONLY information_schema._pg_foreign_data_wrappers w WHERE ((CASE WHEN (old.foreign_data_wrapper_catalog IS NOT NULL) THEN (old.foreign_data_wrapper_catalog = w.foreign_data_wrapper_catalog) ELSE (w.foreign_data_wrapper_catalog IS NULL) END) AND (CASE WHEN (old.foreign_data_wrapper_name IS NOT NULL) THEN (old.foreign_data_wrapper_name = w.foreign_data_wrapper_name) ELSE (w.foreign_data_wrapper_name IS NULL) END AND (CASE WHEN (old.authorization_identifier IS NOT NULL) THEN (old.authorization_identifier = w.authorization_identifier) ELSE (w.authorization_identifier IS NULL) END AND (CASE WHEN (old.library_name IS NOT NULL) THEN (old.library_name = w.library_name) ELSE (w.library_name IS NULL) END AND (CASE WHEN (old.foreign_data_wrapper_language IS NOT NULL) THEN (old.foreign_data_wrapper_language = w.foreign_data_wrapper_language) ELSE (w.foreign_data_wrapper_language IS NULL) END))))) RETURNING old.foreign_data_wrapper_catalog, old.foreign_data_wrapper_name, old.authorization_identifier, old.library_name, old.foreign_data_wrapper_language;
!  foreign_data_wrappers | _INSERT         | CREATE RULE "_INSERT" AS ON INSERT TO information_schema.foreign_data_wrappers DO INSTEAD INSERT INTO information_schema._pg_foreign_data_wrappers (foreign_data_wrapper_catalog, foreign_data_wrapper_name, authorization_identifier, library_name, foreign_data_wrapper_language) VALUES (new.foreign_data_wrapper_catalog, new.foreign_data_wrapper_name, new.authorization_identifier, new.library_name, new.foreign_data_wrapper_language) RETURNING new.foreign_data_wrapper_catalog, new.foreign_data_wrapper_name, new.authorization_identifier, new.foreign_data_wrapper_catalog AS library_name, new.foreign_data_wrapper_name AS foreign_data_wrapper_language;
!  foreign_data_wrappers | _UPDATE         | CREATE RULE "_UPDATE" AS ON UPDATE TO information_schema.foreign_data_wrappers DO INSTEAD UPDATE ONLY information_schema._pg_foreign_data_wrappers w SET foreign_data_wrapper_catalog = new.foreign_data_wrapper_catalog, foreign_data_wrapper_name = new.foreign_data_wrapper_name, authorization_identifier = new.authorization_identifier, library_name = new.library_name, foreign_data_wrapper_language = new.foreign_data_wrapper_language WHERE ((CASE WHEN (old.foreign_data_wrapper_catalog IS NOT NULL) THEN (old.foreign_data_wrapper_catalog = w.foreign_data_wrapper_catalog) ELSE (w.foreign_data_wrapper_catalog IS NULL) END) AND (CASE WHEN (old.foreign_data_wrapper_name IS NOT NULL) THEN (old.foreign_data_wrapper_name = w.foreign_data_wrapper_name) ELSE (w.foreign_data_wrapper_name IS NULL) END AND (CASE WHEN (old.authorization_identifier IS NOT NULL) THEN (old.authorization_identifier = w.authorization_identifier) ELSE (w.authorization_identifier IS NULL) END AND (CASE WHEN (old.library_name IS NOT NULL) THEN (old.library_name = w.library_name) ELSE (w.library_name IS NULL) END AND (CASE WHEN (old.foreign_data_wrapper_language IS NOT NULL) THEN (old.foreign_data_wrapper_language = w.foreign_data_wrapper_language) ELSE (w.foreign_data_wrapper_language IS NULL) END))))) RETURNING new.foreign_data_wrapper_catalog, new.foreign_data_wrapper_name, new.authorization_identifier, new.foreign_data_wrapper_catalog AS library_name, new.foreign_data_wrapper_name AS foreign_data_wrapper_language;
   pg_settings           | pg_settings_n   | CREATE RULE pg_settings_n AS ON UPDATE TO pg_settings DO INSTEAD NOTHING;
   pg_settings           | pg_settings_u   | CREATE RULE pg_settings_u AS ON UPDATE TO pg_settings WHERE (new.name = old.name) DO SELECT set_config(old.name, new.setting, false) AS set_config;
   rtest_emp             | rtest_emp_del   | CREATE RULE rtest_emp_del AS ON DELETE TO rtest_emp DO INSERT INTO rtest_emplog (ename, who, action, newsal, oldsal) VALUES (old.ename, "current_user"(), 'fired'::bpchar, '$0.00'::money, old.salary);
***************
*** 1385,1391 ****
   shoelace_obsolete  | _INSERT         | CREATE RULE "_INSERT" AS ON INSERT TO shoelace_obsolete DO INSTEAD INSERT INTO shoelace (sl_name, sl_avail, sl_color, sl_len, sl_unit, sl_len_cm) VALUES (new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit, new.sl_len_cm) RETURNING new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit, new.sl_len_cm;
   shoelace_obsolete  | _UPDATE         | CREATE RULE "_UPDATE" AS ON UPDATE TO shoelace_obsolete DO INSTEAD UPDATE ONLY shoelace SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit, sl_len_cm = new.sl_len_cm WHERE ((CASE WHEN (old.sl_name IS NOT NULL) THEN (old.sl_name = shoelace.sl_name) ELSE (shoelace.sl_name IS NULL) END) AND (CASE WHEN (old.sl_avail IS NOT NULL) THEN (old.sl_avail = shoelace.sl_avail) ELSE (shoelace.sl_avail IS NULL) END AND (CASE WHEN (old.sl_color IS NOT NULL) THEN (old.sl_color = shoelace.sl_color) ELSE (shoelace.sl_color IS NULL) END AND (CASE WHEN (old.sl_len IS NOT NULL) THEN (old.sl_len = shoelace.sl_len) ELSE (shoelace.sl_len IS NULL) END AND (CASE WHEN (old.sl_unit IS NOT NULL) THEN (old.sl_unit = shoelace.sl_unit) ELSE (shoelace.sl_unit IS NULL) END AND (CASE WHEN (old.sl_len_cm IS NOT NULL) THEN (old.sl_len_cm = shoelace.sl_len_cm) ELSE (shoelace.sl_len_cm IS NULL) END)))))) RETURNING new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit, new.sl_len_cm;
   shoelace_ok        | shoelace_ok_ins | CREATE RULE shoelace_ok_ins AS ON INSERT TO shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant) WHERE (shoelace.sl_name = new.ok_name);
! (44 rows)
  
  --
  -- CREATE OR REPLACE RULE
--- 1388,1394 ----
   shoelace_obsolete     | _INSERT         | CREATE RULE "_INSERT" AS ON INSERT TO shoelace_obsolete DO INSTEAD INSERT INTO shoelace (sl_name, sl_avail, sl_color, sl_len, sl_unit, sl_len_cm) VALUES (new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit, new.sl_len_cm) RETURNING new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit, new.sl_len_cm;
   shoelace_obsolete     | _UPDATE         | CREATE RULE "_UPDATE" AS ON UPDATE TO shoelace_obsolete DO INSTEAD UPDATE ONLY shoelace SET sl_name = new.sl_name, sl_avail = new.sl_avail, sl_color = new.sl_color, sl_len = new.sl_len, sl_unit = new.sl_unit, sl_len_cm = new.sl_len_cm WHERE ((CASE WHEN (old.sl_name IS NOT NULL) THEN (old.sl_name = shoelace.sl_name) ELSE (shoelace.sl_name IS NULL) END) AND (CASE WHEN (old.sl_avail IS NOT NULL) THEN (old.sl_avail = shoelace.sl_avail) ELSE (shoelace.sl_avail IS NULL) END AND (CASE WHEN (old.sl_color IS NOT NULL) THEN (old.sl_color = shoelace.sl_color) ELSE (shoelace.sl_color IS NULL) END AND (CASE WHEN (old.sl_len IS NOT NULL) THEN (old.sl_len = shoelace.sl_len) ELSE (shoelace.sl_len IS NULL) END AND (CASE WHEN (old.sl_unit IS NOT NULL) THEN (old.sl_unit = shoelace.sl_unit) ELSE (shoelace.sl_unit IS NULL) END AND (CASE WHEN (old.sl_len_cm IS NOT NULL) THEN (old.sl_len_cm = shoelace.sl_len_cm) ELSE (shoelace.sl_len_cm IS NULL) END)))))) RETURNING new.sl_name, new.sl_avail, new.sl_color, new.sl_len, new.sl_unit, new.sl_len_cm;
   shoelace_ok           | shoelace_ok_ins | CREATE RULE shoelace_ok_ins AS ON INSERT TO shoelace_ok DO INSTEAD UPDATE shoelace SET sl_avail = (shoelace.sl_avail + new.ok_quant) WHERE (shoelace.sl_name = new.ok_name);
! (47 rows)
  
  --
  -- CREATE OR REPLACE RULE

======================================================================

#12Bernd Helmle
bernd@oopsware.de
In reply to: Jaime Casanova (#11)
Re: WIP: Automatic view update rules

On Mon, Dec 22, 2008 at 8:53 AM, Bernd Helmle <mailings@oopsware.de>
wrote:

--On Mittwoch, November 26, 2008 10:54:01 +0100 Bernd Helmle
<mailings@oopsware.de> wrote:

Okay, i've finally managed to create an updated version with (hopefully)
all
issues mentioned by Robert adressed.

Hi Bernd,

1) i found a crash type bug, try this:

create table foo (
id integer not null primary key,
name varchar(30)
) with oids;

create view foo_view as select oid, * from foo;

with this you will get an error like this one:
ERROR: RETURNING list's entry 1 has different type from column "oid"

Hrm, seems i've introduced a bug while implementing RETURNING support.

but if you make this:

alter table foo add column description text;
create view foo_view as select oid, * from foo;

then, the server crash.

STATEMENT: create or replace view v_foo as select oid, * from foo;
LOG: server process (PID 16320) was terminated by signal 11: Segmentation
fault
LOG: terminating any other active server processes

maybe the better solution is to not allow such a view to be updatable

Yes, it seems we have to check for target lists having negative attnums in
checkTree(). Another solution would be to simply ignore those columns
(extract them from the target list and include all updatable columns
only).

2) Another less important bug, the WITH CHECK OPTION is accepted even
when that functionality is not implemented.

updatable_views=# create or replace view v2 as select * from foo where
id < 10 with check option;
NOTICE: CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
CREATE VIEW

What do we want in this case? We can throw an error telling that CHECK
OPTION isn't supported yet or simply issueing a warning.

3) one final point: seems like you'll have to update the rules
regression test (attached the regression.diffs)

okay

Thanks for the review so far.

Bernd

#13Robert Haas
robertmhaas@gmail.com
In reply to: Bernd Helmle (#12)
Re: WIP: Automatic view update rules

2) Another less important bug, the WITH CHECK OPTION is accepted even
when that functionality is not implemented.

updatable_views=# create or replace view v2 as select * from foo where
id < 10 with check option;
NOTICE: CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
CREATE VIEW

What do we want in this case? We can throw an error telling that CHECK
OPTION isn't supported yet or simply issueing a warning.

+1 for an error.

...Robert

#14Jaime Casanova
jcasanov@systemguards.com.ec
In reply to: Bernd Helmle (#12)
Re: WIP: Automatic view update rules

On Sun, Dec 28, 2008 at 9:29 AM, Bernd Helmle <bernd@oopsware.de> wrote:

Yes, it seems we have to check for target lists having negative attnums in
checkTree(). Another solution would be to simply ignore those columns
(extract them from the target list and include all updatable columns
only).

i would say check for negative attnums and deny that view to be
updateable because of SQL92 says in 11.19 <view definition> syntax
rule 6:
"""
6) If the <query expression> is updatable, then the viewed table is
an updatable table. Otherwise, it is a read-only table.
"""
wich i understand as deny updatability in any view that constains non
updateable <query expression> in the target list

2) Another less important bug, the WITH CHECK OPTION is accepted even
when that functionality is not implemented.

updatable_views=# create or replace view v2 as select * from foo where
id < 10 with check option;
NOTICE: CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
CREATE VIEW

What do we want in this case? We can throw an error telling that CHECK
OPTION isn't supported yet or simply issueing a warning.

yes. if we didn't do that we will be against spec. syntax rule 12
(again in 11.19 <view definition> ) says:
"""
12)If WITH CHECK OPTION is specified, then the viewed table shall
be updatable.

"""

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

#15Bernd Helmle
bernd@oopsware.de
In reply to: Jaime Casanova (#14)
Re: WIP: Automatic view update rules

On Sun, Dec 28, 2008 at 9:29 AM, Bernd Helmle <bernd@oopsware.de> wrote:

i would say check for negative attnums and deny that view to be
updateable because of SQL92 says in 11.19 <view definition> syntax
rule 6:
"""
6) If the <query expression> is updatable, then the viewed table
is
an updatable table. Otherwise, it is a read-only table.
"""
wich i understand as deny updatability in any view that constains non
updateable <query expression> in the target list

Yes, but afaiks SQL99 allows partial updatable column lists, so we could
argue that we can follow this. However, it seems your approach is better
for now.

yes. if we didn't do that we will be against spec. syntax rule 12
(again in 11.19 <view definition> ) says:
"""
12)If WITH CHECK OPTION is specified, then the viewed table shall
be updatable.

"""

Okay.

I'm currently travelling (visiting my parents during turn of the year),
checking my mail sporadically. I'll provide an updated patch ASAP.

Bernd

#16Bernd Helmle
mailings@oopsware.de
In reply to: Bernd Helmle (#12)
Re: WIP: Automatic view update rules

--On Sonntag, Dezember 28, 2008 15:29:58 +0100 Bernd Helmle
<bernd@oopsware.de> wrote:

maybe the better solution is to not allow such a view to be updatable

Yes, it seems we have to check for target lists having negative attnums in
checkTree(). Another solution would be to simply ignore those columns
(extract them from the target list and include all updatable columns
only).

While looking at this it turned out that the problem of updatability is
more complex than
i originally thought: Consider a relation tree of the following
views/relations:

View1 -> View2 -> View3 -> Table1

That means, View1 consists of View2 and so on. What happens now if someone
is going to change View3, so that it's not updatable anymore? What the
patch actually does is, scanning all relations/views involved in a current
view (and cascading updates) und reject update rules as soon as it finds
more than one relation within a view definition. Unfortunately this seems
not to be enough, we had really check all involved views for updatability
recursively. The infrastructure for this is already there, but i wonder if
it could be made easier when we are going to maintain a separate
is_updatable flag somewhere in the catalog, which would make checking the
relation tree for updatability more easier.

Comments?

--
Thanks

Bernd

#17Bernd Helmle
mailings@oopsware.de
In reply to: Bernd Helmle (#16)
1 attachment(s)
Re: WIP: Automatic view update rules

--On Freitag, Januar 09, 2009 13:20:57 +0100 Bernd Helmle
<mailings@oopsware.de> wrote:

That means, View1 consists of View2 and so on. What happens now if
someone is going to change View3, so that it's not updatable anymore?
What the patch actually does is, scanning all relations/views involved in
a current view (and cascading updates) und reject update rules as soon as
it finds more than one relation within a view definition. Unfortunately
this seems not to be enough, we had really check all involved views for
updatability recursively. The infrastructure for this is already there,
but i wonder if it could be made easier when we are going to maintain a
separate is_updatable flag somewhere in the catalog, which would make
checking the relation tree for updatability more easier.

I've decided to check updatability of all involved views during view
creation. Please find attached a new version with all other open issues
adressed.

--
Thanks

Bernd

Attachments:

view_update.patch.bz2application/octet-stream; name=view_update.patch.bz2Download
#18Bernd Helmle
mailings@oopsware.de
In reply to: Bernd Helmle (#17)
1 attachment(s)
Re: WIP: Automatic view update rules

--On Freitag, Januar 09, 2009 17:53:31 +0100 Bernd Helmle
<mailings@oopsware.de> wrote:

I've decided to check updatability of all involved views during view
creation. Please find attached a new version with all other open issues
adressed.

Oops, forgot to track some files in my new git branch and so the new files
viewUpdate.c und viewUpdate.h are missing...please find attached a
corrected patch file. Sorry for that.

--
Thanks

Bernd

Attachments:

view_update.patch.bz2application/octet-stream; name=view_update.patch.bz2Download
#19Peter Eisentraut
peter_e@gmx.net
In reply to: Bernd Helmle (#18)
Re: WIP: Automatic view update rules

Bernd Helmle wrote:

--On Freitag, Januar 09, 2009 17:53:31 +0100 Bernd Helmle
<mailings@oopsware.de> wrote:

I've decided to check updatability of all involved views during view
creation. Please find attached a new version with all other open issues
adressed.

Oops, forgot to track some files in my new git branch and so the new
files viewUpdate.c und viewUpdate.h are missing...please find attached a
corrected patch file. Sorry for that.

gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
-fwrapv -g -I../../../src/include -I/sw/include/libxml2 -I/sw/include
-c -o viewUpdate.o viewUpdate.c -MMD -MP -MF .deps/viewUpdate.Po
viewUpdate.c: In function 'transform_select_to_insert':
viewUpdate.c:1407: error: 'qual' undeclared (first use in this function)
viewUpdate.c:1407: error: (Each undeclared identifier is reported only once
viewUpdate.c:1407: error: for each function it appears in.)
viewUpdate.c:1407: error: 'viewDef' undeclared (first use in this function)
viewUpdate.c: In function 'CreateViewUpdateRules':
viewUpdate.c:1731: warning: unused variable 'view_qual'
make: *** [viewUpdate.o] Error 1

#20Bernd Helmle
mailings@oopsware.de
In reply to: Peter Eisentraut (#19)
1 attachment(s)
Re: WIP: Automatic view update rules

--On Montag, Januar 12, 2009 14:48:46 +0200 Peter Eisentraut
<peter_e@gmx.net> wrote:

gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv
-g -I../../../src/include -I/sw/include/libxml2 -I/sw/include -c -o
viewUpdate.o viewUpdate.c -MMD -MP -MF .deps/viewUpdate.Po
viewUpdate.c: In function 'transform_select_to_insert':
viewUpdate.c:1407: error: 'qual' undeclared (first use in this function)
viewUpdate.c:1407: error: (Each undeclared identifier is reported only
once
viewUpdate.c:1407: error: for each function it appears in.)
viewUpdate.c:1407: error: 'viewDef' undeclared (first use in this
function)
viewUpdate.c: In function 'CreateViewUpdateRules':
viewUpdate.c:1731: warning: unused variable 'view_qual'
make: *** [viewUpdate.o] Error 1

Fixed.

--
Thanks

Bernd

Attachments:

view_update.patch.bz2application/octet-stream; name=view_update.patch.bz2Download
BZh91AY&SY���|4���?�������������`}�xQ�W�>�����l����>�}|����-��������*m���@�+��+l:D-�����G,��������f=����_�������;�Uu�}w}���wcJb���^�o����T����\�v��K������Z��)����g�+�U������/�ER��{��/�UJS�i�p�O����s}g��Oo���.J[}���1,�O}������{O[�wV��K��p��OX��o9����mO������f��]J�������k�*}�D��:��{��bt�������N������s6�,.�A4�1$�&�&L���O�)�F���<����OP)�AA44�4mJ{F�#�������
4i)�&�l�G�6)��T�
��=F�~�4'�R�2MG�'���=C��h��D�CQ���b&52���)������=$��<S����=F��H���M�&�������a�)�������#���H���B$  �^J���e�������V��W4������kQm�k�j�d�Je��i���kMI�j��uj�9���E@�@W��0��/�
�J"TW
�+^���������^4����Bd�!2F��(�J���c �O��g����J�j���������y����u��X��da�J�m�Zkyv���fY-�w����J���E�����)D"��u3���Jl����O�i(0c$���/K���2��0T���	�����	����B`:�m!��F���&�HA���(� T!0�R$`H��#&���R�J��k5RJQ�����L��������u�E���B�%�F�i���L��eC(�&����L�VM���i@{z�M���X+1�Q��4f���)iMR2jd���46�����[���JXHM���
����h��2)IeI4�b[M�&�-h�K)dQ�E���J�`
��yw��lS����A.���������o��x	$����	C:
;��1:�rI�d��������iB���3a0O��o�&�C�53�=�\9�|
�����?��Y�������tt��I93l�-��Ns�i�43?���amn3tY�>�~�\���I gq�9�3�y���Q}�!����������rL�����R��0�� ���@Bl���s�� �� 8�9vH�H��Q��~��:%<s�iR�CK��wET����\�R�b_����RC�
��V������f�������

�1��h�$"%�n�:�H�p�
��z���V�S��:��>��o�>������5��0U�t�<�{��n��Z*qOw��|��)�]��#�a����Vj����=E�X?��v+������U�(A��\�'�M�'�6��W)��#�~E}-+��?�������'sa�W�6@>���E	��^�
��x���I�B�%�V�wty�51�1������wt'N����72��P��NC���y��8p�uE0��q��T�����&2`rY=����������-+��n��X�S��� ��1�	|��d>[EX�s��1 ��p�>���5���f��:9+N�.�*e��]6�EN��q ����WJ��B"|��y �(��A���r
hw:G�t��^>m�*v�5=\M=|�B���-{��wV���z�����X>�um�P�|�����5���Ax�f�B���UR���2��dLls02��`�2�F�]�&��0cmB���E�"
�Z��P�`�,J��EZUK������U�6�X1����V��Z���\���b��1c\�{;���b��q�Q���W>�����f"�3Nh��7�X�zo�q��4�������f��$�g\�z�rA�?x����x��.>�v���/�E&�s n��"KR!�C<���I�<��0Ij��>�OE�+�)+���j�����a���,-3����� LZLx�>N(<�AA�D�
*{�r��5~��I
�a�<�|���\^�wCW��|���C�+[*R5�����}d|��$���_g�F���L�EB<^o���`������Vm1(W����~3�S��\�
���rj��,��������]�FT�4�Sx'E���z�r0`z�9�5~6��W�ZL��
�&+��.�`��4��B��H�%(�,H,�],�i��k��X��6�����-�b�T��u���������fF1H����mm�dMm.���2��6�fkn����d�����F�4�ci:m����M���3Z�*N�n�e^�n��(e�H��%��+&�&�b�mJd��j�5$S�U'��������qZ}T�qv��@�u@G1����"�uQ�����bMJG�X����p�b-�PP�SOv�-�e�m4w}FO������E^Cv����5{��1t&�VS%1�aV�H[i�A�i�5�KG d�}�\���>��rhY���'�5���SQ
��2l.�Wfa�V_�-_���\�m�� ��kq�L������l,U�>��_h����R����G3��9�\��D���9���(�D��6L����?�v��N��q�7�T�(�H�S,�xK�[��H���>	d�R��6%��H���Xf*_�����b`�$:B��*:�H2.+��%���zt�]$��(�`P���]N���I���N��\�������_���V��dx�Xh����}�U�����~"�F��+m��%���!tf
b~��#�
�?�!+���{��'>��Y�}|e.�J(I0��!L�$?��f����l�nm������1�
Y����F�:���P�&D������t��0�h4����N�M��z�;W��#��W�&���~��zsE�2r4o�gb{A����@���Mpf+�, 6Gi#�����s���j���5�}c�m�Z����k�KoVL�5�U]�H�&T�����P��LK��ER�
��������E�LPX=�����"*�B�s�x<y��|.���k4)IRW$Rb������O�������bb-~�����3����z������J�I������E�ii�����t�d6n�|�����Qf�����(��a�����e8����G�T �b�e��XL����,���x]��FTT����:��w��V��5��-6�p����K(>�g�E���8���$�>4���$g��H�"����0�9m�*N#0�R5`r=�6X�C���8�Q.����:�
!�����&����/�U�&`����f?�>�a�}�#��>)��W2����G��g|�]#^���f�9�y�0��R�\������_��u��i�+,_33��^�,��:!t�_ZmQ!��3��jO�r�U�c�J1UQ`���^��������b@ADy}��������=�M��������:_[U^��8��������{��)�����+Z�.b�����ox�'����������x�1	����!/>�H�q*���P��o�Y33����[�#�����O��g;n��M.���`�w�^�G���h�V�~��|��l�r<��l&s��~�	y�6v?ck��(a�Ol��4�v���c�'6�T\WM4�&xW��]���]oix^!�bVhO�4!no�s	�R����Kr�2H��e���=��EA)�9k�?����2s���"gF�w���o���U,P��s����C771�����x��C�������#�?Yt����?_x�1�X�����P�5Z2A���P�HM�������`�T!�h3�f�G����lo��xt��x`z:�]}��4V&� �HF(��(i�uy}N!����*�d�$.?�%�?�7��54Y&cx��S��&xPm,�Ml���{�&�>����6���r����]�P�h��F����g&w�
l���M��j�%�3�G�=�n�H�8/|+u�H���A�2�����)���-�<���Ah^��<�vd �6�W�
��&�Z�P����z]��|J?$��L�d�v������C��_�2��`r�;i$�Y�1mL�7����$��7��]�g�w�x\`�,�1-"7��?�)�;S/q+CR��0�����{E�7���������
����rw6�����3�5j�����0�1�������R��P~M;�os`�wt3���2n:%�bg�E";��x����N��Sr(�
�l^B��v���"��7���~��V����=��d$$ag���~��������m�Y�}a��q������E2�P��J0�o�����^~�<=���Y|�jH ����[�f�����:|#��NJ�dB�or;�'$Md
��h>���q7b�1��w�t�C���N[2�2�Sj&��2���>�Ss�
���q-:�v%�O3^�Q��c����y��<|��|�^=��p�[V�����vI�����jg����!�Wq��u���{35$��H�@�
��W��r���W�	Tc3��0��3P�G���tG�w{����yM%�����7K����8���}���G����W����}}h�{x����V
�v������uo��"�L�/	��+������1���I%��op����
YJ�l��!�g��'�u����Q$GC7�Xi$+G1�������7��6�rv���S5��-c�%��M��c��+���l!����_9�uo%����h3`��Li��8��������'m
70;&�O����������o�5��'�bP`�
!L!���p����m�E
�O(�.v�'�j�
r���u��mQo��{y���k����i3����aK#�5�a���U���`���8��d2d��������4����
���\���,�H�1����	��"��u"���G{�n��9��d�d�v3��5��P��xl�`�����������D�Ry��P���'b�#�%]���1�(M<��0D.��EyI���Q1'tTO�/DKt�n�u�<��Y&l��v�x\��w�������T$��hM�v_���{5�������:1�1	����>��N�h�[`|>��Mf�J���Rg�Q�8�$=%�2d]���)��{-C�����.��������WI��<�
��������	2C!�����k��ej�k@�zs��$��P�{�xI:GT�TJY����=��A����zt����o{����8R=�?Q�N�hW\��E2��C;/Wc��A+������[��bbJ�1
��
�xM����?�AM�ET7#�5���)���0�d�UC����G�����g�N���&P�i�G�9W����^kL�r��=,�5��m�@��c������u����F5����i�������n�n�?��Bu2�T��Q����%��Ssr������������PZ'�w�U���+�������_�*c��ML��Z����W������AG6W�;�RE�j&��Mx�D;0��7f8R
Ge4�	f��i��7�{��o�q�9g�1�p���"��������9���of��4+�^�i*	;[-��w������Z�h��������+����1b
�{"U{�3;v6�)v�kb���e��^����tF��B�<	��Z�e�~���$B�V�N}��iF�I�1;A�i@QB~"��4M7l7����%�VB��j�2T������G6f�3���s������R���������c��6�����<��T�S,�Ws>7�>�U�?��^z���O:DOg����g���I���p����l�Y�|a��4�D�����@��"��k�;��o��XIV�����o��������:'�����C9;�k���:���(�K�p�t�qb��|�[���� ������f���1�7�������!g��J���%]I'�~�����3�}f�~�;�z�;C���^����Sr�7_�1��N��a�$���P7V�F	�F����<���f�:��)�.���C���E;��2�K�Y�X|�K������|����3��^��6��3jMo7�C@��7c�'��T�&���n���4z<|y��z�������br����������6i������9D9�_����o����q���2��AF��n�%���������,2WJ���T����SN�����w�����g����y=�^r�i��=*M��4��B����J���;��t��3,rb�_�����8�x=���xgx��!���DHr�4�=�CP���v����t�"��0,���L0u>WYNU��-\:�S���l���Qa���_D�G_Ffz�n��j�G9)�������NS��q/s�rHr"���|U��*3O?yS��LD�*|��*���wZ>ABgm��������]cC��<�a�9�����a�p�������o�l�{���&�����O[�����vvwb\�'T*s���	ysHv��y��<�@���0(�^��1�y�/�lS���V� �_��?'8�|�����oS��B���EG
������yg����������.)��a2���9���1($��5����q}|�����R���Z~\x�@�4hy��k�~���s����s7��EN5��xF��2��$�ZQC���C��������P�*���	��83'O8�����B(BNp��^��TmJQ���:^:61�I��w�b������>-���:g8N&I�����TM�%" ���m�3�����
�lD��9g|���w8[A#9�`W-X�yg�kd)���3����WA6��O&P#^Z����Y��w(�'��.��;�(q�����R�4�J�!R�9'���;���+w����������e?[�4�z~���������H6��3|�:9i�kKMqh��3���:�9��q�v�>0=~.�fL�u��_�����e���{A&Q�t?���V��^�b4����[��3M����m%B�f��ZuCR�%}��h����)xN�[��CR�'y5��V��)wkB
�vm J�v�,���6��fg0CP�}�c��2l���������1:��A6AO>� ���q.4��;u��&fI=T�Q%�Sjh��������v��|�vR��(�1�%?�C*�h<���E8;��v�
+�=���?"r9���$@�������@0EJ((A�����T_�'�.��a�������;����������\
�#&A�)���f��L^�P�=,0������#��~NsQ���-w^�RRlt��:�s��^����w�������C8�l�����m& s:j8�;��h1���R���l�H��q��������#�S8Xj�2N��H�~�8M��K���~6nL_�g�fkfd���&b�:13�s��B���EB�i�6n�����B��Q���L�&��=	��o*�!4?d�$s8�H��P���� fFN��P'(#�����$�����@�a�.������S���d&sZ�����2Gze��>%M�	�>��%����5�40��B���[|�'"��U(��Y����Y��'7E oPj����s�����$m���*�r}]�/����ut���������_�*p�\C�=K�S�g5�V�F��^]�Bf��\�o��~�h����)v�����{�}�o�_�1�R����c�@f�Y����$�@�Y�D}g� A�6&W�$�U	E�%��v�'��b�Y����N0�L*�cn����(�r�'ci��|`��W
�R�d�^��0����U��C[�Fja�L�F��`E�h8�N�k2�3��^�����]U���:����M�����v��9���~�^��+��p���9}��Gb��j�S)8�)4&�`_�����'�N1�]nF�_,�d10����^4���C�4:U���SM��X_8���L*Rm������US�TT_����7���8�O�J�������;���o��c�^�+������{����3n��w0N��1�|xR\����{��c���f�)/���j4����M��m��Mk�Qm��wI��$�
�f2P�P[&K����HT$EI�W��h;m���uzMF��i^����,����Xi�G)�>5�2f�i+F�����|�T @�����#B!B#��V���R�D�	�@!6���,	�����H���JCK.�$�EM,�j*4�*�" 
�+��_-����M��O�\J|��/5�9�e�����.�H���x�h D=�����D�������R�3;Dj����U��O��5�fM����6]�?EC&�Y�BF�C�i�N0�T�����r�g��[���9 A'wL��l
����D��?3/6�IO�>�a����� ��4^Z��,fi�����SI��M�~���]Ae��R\Z�ZHk�vS��NsW�/~�Ac�a���E	�_W];�x����
��&��\^T�6�����Q	�&gjf��������bf
n���'Q��������U'D'��AYn�of�F���B/y��Vj*%-�o�vG���C�C�����ea��s�L5���uQ&<�qY�S;\.��s������e��y+��@�JMN�.U�6�������*FW����?S���)��~
:��7�/+/&qw��V��i�����2c�ek9�l�C�)90�gN�A/3%61Q8Q�����MR����ff?:����
���"���DH���>X�F�D!H@��{�E�2+�r=��s����B���3��&hm%���N�k�*����Q�7�������=6����v���]B��@Kk\r����r}Dm��jl}NfX��NZ��eQfP1!��[�(8-����a3�r�=��2�#������������<��s�����(�������x��i����g�|�������wh���'n�4"����BnV����`Wt�$:uQ��gUb�����
���������#��g�z�4�j�2�^U��kU,��(kaG6�x���(�4tIH:��7}�`��h��������%�4TP��S���#�:J�f��z�=�`uu5%��!�r��.�D�W���e��5�-#�`"dY,�B�mV����&R4`���R����*g�C���%�!������![�8�������.>��n�6�#d�Mo�Z����m/�������D�t�U�y��*D���p�j��<�X���I%"�Ck`O�@�+��I�`4�����>�I���)��94�p(��)!B�}5^[�/����h
UUUUt�O*Rp��4=M`�X����o�����C�r��Q�@��D�.�f
�x�'@z+��t���x�	6C#f
�L��d����	���?�}��|����]p����K�!���D��6Lt=(����A�=�$Uc���f*8z���k�\�����1[�@A�k��m��6������L��x���4>�'I���'��������$��+�q���(q�<�z<<��e�b�P&38:aV��1�#e��?������uh�l#�/�c�k>���dP��D�KA���X��6��{�[��w�h�')��}��A�C�YF�X�e�bb��=vr<��4��,'gx@ �~ic���'?�f6]�q+ckQscAe�:�TYI�+�lA\����n����F�VE}iQ\<��i��NaJ��D��R&��4��D��\�[rv�4!����EU<!�K_� �L[]�v�k)����H��Q����ps���f����0<{;ym�/�9����A�&h��fqVJG
3/���FQ�������_=`�GI��w�lv�4���-r�$[�!mqN�$������������q�v�}������e�������MI4��-��YGg�V������m�����b*���1���T�����:v��x�������8;k#�BG���b�����|��	��-����t�����R�|������S@��E3�Faw���3P��o0z@���������x9>��H���g>�=9WS
�a�-rs_*3;�S��A���A��t$y${�v>t����v���(<LM�m�0!�c��bw�������������@lnw�A�����`������T�ZTG���i�A�
������H�{q��;";����'��|RDHS�7(���Hb����/��q�3$n����'=$g>�-�|c��������������[��v����sSX�*��q}]�\B�n�YjA�}�c%�1m���P�������(W�V�#S����lw�!Zf�Q$�*x�<�@���{Pp��%���Q�R��4��c��x>4�>x�K/�^#�QC1$��-kbh����J��AS����s]o������d����^6���|MB��R���o<������B�g�oO*��4�Y����4��uM�4
�����"���_�u��*���NW�Q;�/Ggr�Y����2'F����D��F������4�q����WS���$�Wj]i,�z`[@	�$X�=�o=���;��������Bd��i�Y@��Nz������"krQ��c;K&v�]u��CA���A"�Z�c6b�IV<l	h`�1wZ]��5-�aj�0E���HDT1��I�]~�<m�/N��O������������~�T�4s�"�8�����<����]T{��bA�������'������#!!#�����=��������]��P~�?��Sw ��
�"Q,��{����2���a�d�W�#�T /��A��Au���x0�T7��#t}M�'d�S�	o����_yzxP`~g�]�x>����]o��6��2��>'��yKG���
Q,��e��*�AL���1t� �4�Hn7y���ywVtM��iU/�);8<�k����8d������L�����/}K�����\�.XE!��
B
���#,��O�q����!	xP�1����w,'|lQ�n��`�@�s�)����x������2����lDL�%/X3��:�;�����ac�MEMk��S`�����G]�H�p�������N�a�%���48�~N��O�D��)�2e���m�������t���c�x"��Y7�JPD!�6���C��L"�(0p@�7�x����Q�M�Z8t����^��#�GX�����mv|X�������>,~C1M������l$��h�J�3z�����-z�j��40`����6� ��~:���$9��{�-�x��`�"x��{����7�;+k��>%>�3��C#=�i���y�=�Y�>I�:�e}��6�`8+���,!�=�z����B��3�(�.P&��Is|���y�k%�����>�7�R2I�D������TL66"9����5p`�1<���'��|w�7.��%eO�.{�>�����w�����^��2�L��Q�L���4��"z�@�L�L]B3}���F
�Q�l*�4x��j.�6���T�I'tEj)�"�f�T��$������������INh�dG##�>S�@�|��l;�=&n�v@���
j�����2�"4��o��-C]S�@��W�J>Sy����T���=(t���l�E?T�C��5K����_�j��t��oi�t~�X|����{���T�gB��r@�!���p!!� ���J��p=M=:�����.a�B@��y���Q��*���y�8/���1pGMiOu��Ca~������~����A��W]�P"ju��h*s�ca:�@-V(�6>���� �
H�))N��H����Y�*w6�A�$
�d�R�������������W{��-B���+�n�4��^�-J>g��_�rd�Ij��_��/��
����PH0���D��__�-3bN��(�|�)����	�1OT�������- B����w�u_9����{J��sh�ZW�fD�H��%����)��&5�!O�	E1O�����������R(������E�d��3�	Y�d��f��L��jI%.Hh���C��I�����D��0��"	�!�f;B���S�e�����(��SI$y�@��bg�}�TYO�	�����O�PjvCw��|�P]��i�S����R���Lz��a���� ����?�� {��^��>"����DJH��*w}^�����
'�{��C�����F��Q%#p�0�D�p4`�&��l�o���<�b�,��`X	�$<���� Z������t��{o�������=���|Y�)���������!�?8S:�.�������%����}0������5������������N�'�������1T�A:Q������{������
(���2=�#'���$#-��
�������x���m
)��@�'8p����$H�@���&�>
��2p`���9Rw�D�G�DQ{�5%��G�s�$@��:�����Ld(���0a�t��
-�Bb�l?{cr#� �;n�u�@,��-#<������-9�*e�������5L��v�
�L/�������������ze��k�#Y�x���*4��e�5��8��BN��$�
�Zn."��<
,-��a�y���\R���P|������$	"D���BC
���S!�XrgN4#��������x6��R��D5�B�����u.�O��hH;#x=?r��qx�d��!9'�QA|���I�6K)�8�p"- _�\��������������=�����v&�h�La@�E��n�M��N��U�?��a�����GTB�E"����1�@�C�!<��K^�6d�h:.h�,0�.dA�Y��0G� H��$FA}�M��(zM�$1�F�$�)�r�L����0�3�0�Si���n������p=>i5�}P���pZuz�/Ts�W!9�?�X}������!E)F��
 hY�Q�@�;�����q���-���r:"}�$A�F���<<A�@^i��D9BBBC'�M�����4�3i��G��B���(E�{:�����K�����p�*��k&,�A����nNq���������*Cb��4nMk�����j�����bv}Y���
-0�SZa��S"& �H���"�xN�yp���/��$a�X�$.*Fv0f�����a5!�$)��VD<��o�����^].�$�F+G;:t�gt�"�Yz8����b��%;��6(����@�"l���������Vq<���T^��%�ER�^8a�3��� A" D�Hv��:�'��$��N���i��@($��4�����S��"�q9��/3�hH�����ED���.�����Q$��Aq�����j��o�[��0��p�0L��[�&�
J���r,�!+�,B�}�3`MGJ�W�&i���������]�����7����Pm2&�}��SR2�;��$ ����N����1������
��X�$��#�}��E�n��A���������jm��>K��YM@�	����a��(����C*����*S�I�>�#\���u_v��#���0tQ
pdY�R,"�E�	v���
�r�|���@��:���X�5)^x��L%����C��i6�zBFA$Xh���@�v���JC����=0���0�@@��j���	C#6�V��R0��-D-&I*����a]��
��������6 ;T��.��1A����b��n��7��VT��}@��:��$q{������c�2��u����t�y�(�(,9�����l������K��3i70�h��aX�����Sw3�Vr����8���!��jPS���!�����w*�
Jg
Y�l(����K��I���t�
��V��N&��bTn��*Vbc	N@dA�������r�1;��/f��M���;'�Hp�`l(bY�������x�b��v�M������@��!#S�V�LMa����_��0{#���/�����C����7r_;2
nt\��W��|L:P������\8A�� P/+
,�U�i[q1���K��Xzv�z @v�����Hg	��eq���QTF����e'�7@hh����y�}�{������*����-Ul�V���f#��#�XM�������t68������!��e3
���e��!������@����-6�yMXc;F��xAJ��#@��E�,Q|]5��h:"��+��u3=�
x���j���D�,NN��(�B]+�������5@��������a����F�5�?��!�8vt$!��r������h r����g���j���c8;�Q8�h����o��-�4/#�"��ra�N���L&��,�
i2J��3����GN���f(�v�~l���T=Cq���`�z;,�d��a,�[���2$��D
F�����e�A�j�O�}�g�;\�7O��`q�l����b"�eb'G���=RN�����d3�9�kU�3���x���w�tJ��D$4=z�}%��
a��Q��NqFI��:���Wg�/[�#��q�}&�=�����������J!����d���f7��6�$��i���?�w��<����a��X��a��G
$tL���s������\�2��E�,�P���tL�����&%���d������\0���1�f1��*w�a�)�hh��;�$,��b�J�l$������S���L1B0�����sI�K��&�H���i`�
��N�������3�E��wd�~x�>&%�;�$oY��9f%-C'!e!H<_C4!E@���73��������Z$��$�2�[�a���6�HC`SM��&bP�������2���$(W)��FEb�n�!K�`@l�v�w"R���+
�!�00,�
`a#��<����dN��DZd�U��A�7��
�=�����O�����m?�(�A ��'�!��3�c~a�����5�,jy�Ihn4G�]f����8���_�*\��8k��\�a$���TC�CP��<���u��}bd�d��8u&�����:��L�3��-�I�6��g�(8�l�D�P5>����s����sa��}�D,�@�li��r��Y"���h�X���p��)|��9�}�����6E��DA��H�R�m|����4�5CQ��R�#m#h�5��Z����Z�2	�` Xd�XNl�����>'���"HC
zP�F�g�Q�WTN�H; �E_���yZ�%e,�����J�0p������9&u;�����d�����M��r!�'�!������H��0�=��o;G���e�-�A������l���X�D�d��5�!*B/>V}����~��*5'SE?�AD&����`A�zNh�,�=Sx���I�BE=+������G-����)�<|=�v���0c$ZV���.^��*BI��~�,��,�8�.��w�z�4��Hh]:}�O��:��`�r��f�uB�!\X���!�.;�AVz<�T�Q��PrErET���A������<X���Z�u&r�C��U���w�)U�i�@������i�
\W������Ng<w�C�d���)b0����
/q,K���R��Q�@������5o �����C4`�zD��*�m�@6Z��G�}��6I#*�%�20��n$4��3.%!��
�N'�-W���<������a�8@�i$�I"1Q7t�~C�����������0�r������������{�BT	�H����<�(�a��,C��WwdS�u/Z������m*�/�[cdJ�UA%�����)Rd��V6��KVh��������,B
��d���(��D���`A��B[�WQ����[d����	��v;|p)�b�A���
����c!i�;��h}}�HO�{�SrMO?jY
1Z(��0���kk�8Kh


���������0J��H7
{���p�q�V�����6�p��x��1�(��5�3."B�E<�!n{[w:�RNq���_�>Y�U��P���6����#�6�om#� PUdYY�!���Hp��{*�9��Nf���%EtghjQF���������
YJQ:���5r*������,"BG��9)�dK�0
��w�%�
��
<L�����q���8��4�c1�3�����$@�|�>�+r����Q������I,!T�(z��� �0��7D�����1�0�z�E[4i�"��1��APzr��[��sA8��iB����{"l������ee�p))l��z4�����&i2�l%_�-�
��X3CHI��	w��+'p�U�/PZ��,T`��y�`	.�2=���p<}���l���D�E+�B	�M���Ql���Q��C�
��0�1.R�1-�2���'�QR4/�8T����P6|��8D���� ��Np���K�CP}�l��m���5����Mj,m�m������^*��D�D�*!��$1����F�{
��nDNx!�
���$\�$V�����3ghT�J@��m�����(��@3$d$;�
}8U}x��L}�{=a3�U`|h��O�h�"�I� ��|\�X�H��B��6���"�3.:|����[@����I�
�i���*��fQ/�b�����X23��fp��B$
@;y��r���.�u�<�2�%!i'YSm���F3�����-Lu
�����Zg+eR�O�K�N*{��)��5{��m��h��jT��!+ ��-�w'X�������5�eM��{6�6eI�Q0��MJ2T-'�}5}W������P��h�G8##IPm���|�}�	�t�mDi��,Q����4� ��DzoZ,�BA��c�^U���,�L/�^SyW���=�]�B��w1���~�g0Sf�O6<G:�=��T��
�L���A�M7_i�������T2{yl��7�O�d�hH6�rp�k��	$G,��TR��e�&�0	��~��^�Cu�(jl��{v�-�q!m�1e���k��������J8��#x���@�ACv&���.�������6$�&ou�r�!����$;��
����TGZ�B��dv��]����|��*�%D
F0�0��n���01?��g��B�D&s:j6m#D`T*�we������0\$����d� �B0#�@�����#��B��v���9�wJ�iBU-[M 4��A#e�b�VOv�������^wl��*��(�>�7%'�CY�r6$XDb1��v��.�#+t�|^u5�H��A�m�<��l�`TJ"N/���*f��J^��m-�&�#�@�
�,����E�U�d�"��H qq�����q�E	�d 20cT������)��*F&�mj���	�@�UX@��$��c�
P�c�0S��+�1�)��H0��X*��o"6�5��^���0D�2<y�;��.����,Wz�@�)H(�x����0;������>D�
$�RH�D�Y�+�L������G`���s���^�n}�&�e*c*g��P���Y�_���}QU��d���T���jI����$��HA���mh\B�c|��	w��+>"8�����X�_�y;`����T�3E�$S�cF	2of;��
�$	Q�Hd��|O�:��L�m6|���Q0�T�l�~�����xN���}$X���$��Q6Q0���E"Z������P������J��8�}�� ��+5���F���FXp���>\�f�T9��L�Y;�08���v��&�Je������r�9�N&&���j�`9D�-2��������`ZRt��6��b�G�#�'�L3
�0
�����w���u�������4��V�b
O��Jx=��g�9�a���Q�,
�,!a4��f�$c7���� ��;��VQo����=�#h�:�Q�)��H����Ga�!H�����r����<�����5�T�� R8�"v���)�DX�&�SkE��7�
[�L���K@V�v�tLA��IHc��5R�N 
�E`�daO�*n*�:r
�.a_L1RA`E����I�4u�x��l��3�z.�2�*tUj	���m))%��0)7�5���]jB�6T�Gd ��i����a��
!EPL��2�\jE:��A���(�M� yD=	���!��{R�������@�D$i�E���X��!�!Csu,��E��RW+2�W]��!�(d���hu�p�H�44l� ����D�(+�c��(��XT2�Jb��oM���Quk�J��������e��J�W���6:�]{�����w��W�j����=�:�S/bD�&���7�N^'+���T)�Q���pg��	���4b1��59/��q��l�(��Da����!��I�
���}�[��a1���i�
�4�g�v�`�/Sq�H,BFI��6���O���-"TE���"�'��R@�z�;1\��5�p����"z(�;-��~��,�u�������Dd��A�9���1`1�a������Be�v�)316
E��� p�":��}�UB��
`�i���WH��*��w]���6��@pP���C��T
���
%SG�%vu�'|$�mWLpLt����"��y�
<��u��pK�x������`NW}V��_�&}��C���Bb?*v����&��S�6��+A!]%�L
g<|�aP"���;6�Im��2U7uq,���S$�Q��6j��,�����=WHkt�K<���I���E��D*&���H��8�+���M;`��T!>����Q�
�����8��w�>bB�@����!ICg��p��Sb��7[�+Y��)Q|�f&3}]L�n������o��Jph�����O�d�Sb2��-�S�;
0����AcC�D)�7�����xgId,�e�_�!����d� ���0�cP��3�	�6}{��;n���R�w��z:��c+�{�NhZ���L�m�OD���Ba�FQ��%$��	Yv�(9�M��5����SAD��!����%`]qqf���v�o!#H����J�vL}��0	���%������4��*'J#�u:2�"��XD`�����S��>��'�ro1R�
�8�u��o�/��y}��<��GlMR������
������SA0Tp6S�DDT��a��IH7E��=�&j��N���K"1����21��2��%r�\��
��,���@X�1��5T&	p���#l7N0K�Z���Y��V���X�S�n��b�e�1#"��"^��[���i���l*Y@�l,����/��&�Fj.���2p��D9jd�G�CD
�G�( ����g(�>vT��F�cF�V����+��=�Xaw���x`���H$X��$���9
��=�����#$|;�&�=����=�(�<�1(rth/����P��Y���1��M��Q�dPDbD����6l�N�c�)��^�aH���p�$i
v��JLH���e���d{/uC��n�H���n��W�4����A#����{3U�K���3pCP��|V�y0�l��������n$��"���{]!s9�a��LY���Y�
^��XDuih"�B0�R�;���IDH`Hoz�Q��^r���
 ��,]{�aAf�h^���}x5�@�������#���;���T`���H�JQBl
�=*��<���?�
B0�s���S�i���	z
�T��:�&��)h��m�fa0�)ro����
�%���e��(�^jl(Yo/A������Q�V��!�`A��u�(�S�b;Ro���y
���OW��Ca��)��^��-��cf\�4N�����l�0��l���q����VL�c�#���^Q���!�����fK���w�nb���[
�"V��e6��-%L�W���j��gR��$@���&L�|���.�hzK4�2����?[�����!���.���'�L��Cc����4���.S��*Y{Mn���s�7.�]�M�Th���#�'�����gC��)����.�O��x��W��J�	���+�4I�1��|>�*'.6F�r���t�^td�T;��h-u�5Xa����&�K�|Q���qU��q�?���E�k���9L��;J�	W���f*�����~���1��toQ���� �|y�x���Hw�Pg^lz>Y���JG��J\wwBkRT��VX���b�,}�U
N��5�/C���P���g�$�v{�	p��D�/t��IYT��Q���D��JL�

��y��8g���;��xL��;���sy8����r��*`f�%�1�j^�xA@X��'��s?Ai��'x8>���&���;g��J��;����v���������sWs�i��`bV��� jH��	6���a+�Y%.P�O]�h�G���%e�0��F>�`_�D��f�{�A������9�"�F(�p!(��S=�T;�4�xU�h54�%�3D�kD2@��6FD������>����&��J��4������g� � �""I�J"x���������|E!B��%w�65��Z�
M����@��R��^LQ"��M�h��w�(�"V1IM�)0��B������I�b�Y�:��P@�,���0��4�_�WbP�D^7�(y-�8Ce�����������;��	�
s���_Y���N�������������wf��z�*yK8D�R��(pMF
$������r��j�0�������	�M��H�C%,�}�i�4^�
��vq�)6�������N����c(�J�0�j���M�3Y�������Y\�&��h������s/��""�K���mNEz���f�i����K �s�/�hf��.�S�2����o#��dZm XJ#Dm9�f�d$�0�8�`�}�����^�����~#Tp�!c� ����S�tjd�p�D2�/ r�+���6�H�&L�{a�dvyT�I�R�q��������opT����6H�r�#����Bx�ke4t�y>�Dob�����;[ZV�*]:�[)0z��`��2wE8���c:c_N�$B`�e�GBe�9�M(�	������J��9�"l��(c�����P��M���SRX�	��t(���4"!���^�`P($b	�5B��T�)�Gt�~�.i8���vP���(��0��"z`;����o[D��������>��6�_�tk��U	���	���2n��p��{�q�
��IN�#"�R��K�A^��pi�i�C&�[�Z�jUWm����)ut�0DLWqAQ����7*�� 4�����P�'��Ve�h�n�6{�#���n���we�x��32-�k����DB���bm��:{��A���7����`,�v0	��=7�;9Z�],��"�����
�P�jp�|O{���D�!�5����z=bK�m"�}LhGSP<�����8r{6�zD'���K������*�!��L#aG��7K@� �e1w���Tew|a� X|��}v� L`��D�P���:���C�9:g�Y�JP*��Vd%�J�*�<���������AC�2?
&�6�(�T#2�Yp�q�6��m����"030�d�*>2�A!��FFU4I"I!%Pkf�^���s�����}{�tdB$�xe"tt�w�*,��k�W-���d�f���^{��]��=�~ ���g�^���TfCa�n���D9�Le�;*��MK�pgU�xqP�!�C����
SR�B#�
���������g��G5���)41X�.�"�+��J	��AC���C���f���������9���A&�: �1�����3 ��|T4	��?�9a*��P�52!�{N���)�b.���O?
Oq�r���h����22=�v�36W_����d������X�>E9	��w���U�o��[m���%k4�2L�b���5-j5�f�X���}�*������H9RDA�	a������7?�Q�NE����y����3S�����f�T3bf��P ��{��!J��v}����PrVl�z���0b���8��4�(&�YA�s��l$�I"��������H����O8F0�y��=&�1daC����
G����#[	1h]�f��n)QE�/����@���>��}���	;�?N} l�x� ��-�6�X�Sc���],���5~��/�_L([�a#�4�$^Z��|�E�J[ yn8}T1 ��k�b��Y��n���zL���Z�C�.�FD|��S��~k��A��2�P� ���A����3�aO�%>�l*��$>������qq���T�A��78i)��0^��jGh�"oZ�5fF�i�cUmH�%X� zZ����*���
�8Tp���Y��u>����8��Z����$#�@��0���xD�!�����Zf���SfIj�V��)�D��$%%2HR� 6�|��m��2I1$�M�������?�wT���k%
�o��)d��a��$��g�����	����'�US0��v#�6�������.���A�U6�E��lT.%���@��-,X����������2b�-<�>&�����y�������� \b��H|2U��4,`������`�Hv
�NU�@
�R�T��W���"�(Hd�_>
#21Peter Eisentraut
peter_e@gmx.net
In reply to: Bernd Helmle (#20)
1 attachment(s)
Re: WIP: Automatic view update rules

Here is my updated patch based on yours.

Outstanding issues, as far as I can see, are:

Critical:

* Updatability check must reject views where the select list references
the same column more than once.

* Various scenarios of REPLACE VIEW misbehave. I have marked these as
FIXME in the regression test. I think all this would behave better if
REPLACE VIEW dropped all automatic rules and reassembled them from
scratch for the new view. The infrastructure for this is already there,
so it should be a small change.

Important:

* Array support should be clarified. checkTree() appears to reject most
variants of array references, but other parts of the code try to handle
it. Should be cleaned up.

* It is not clear how automatic rules and manual DO ALSO rules should
interact. A manual DO ALSO rule will currently clear out an automatic
INSTEAD rule, which I find to be illogical.

Optional:

* The use of must_replace is create_update_rule() seems a bit useless.
You might as well just always pass replace = true.

* You may want to consider writing the rule qualifications

WHERE ((CASE WHEN (old.a IS NOT NULL) THEN (old.a = vutestv20.x) ELSE
(vutestv20.x IS NULL) END))

more like

WHERE ((old.a = vutestv20.x) OR (old IS NULL AND vutestv20.x IS NULL))

for better optimizability.

CASE will be quite bad for optimization, and then you might as well go
with IS DISTINCT FROM, which is just as bad but simpler.

Attachments:

view_update-petere-20090117.patch.bz2application/octet-stream; name=view_update-petere-20090117.patch.bz2; x-mac-creator=0; x-mac-type=0Download
BZh91AY&SYk�V_}B���?������������`w\;�T�J�^�����v`z������|�>�oy��x������]s��;���F�{�k����3���y	T�Wv����
*�����������Z���=Up�=}_>��}w�������z�v�����]�J���W��,���n�#�Y�����mKj��.�xM��j"��u]
�{��MN���|���QV����w;+V�������7���=�����V+9m�����z��{�n�������]�
�������tj�_���]���=��'�3�bx�{���u��	;�����v����}�}�}.�J�K��x�@��&L�I�1�M��A4�*x�F�F�h��Jh B�I�*~��R��T�DO*oT�Sm�OPz���4�&�$�50MOIOm'��)6��hz���h�OP�)$&@S��0D�6U?!�M#Q�4���y#��hz�=@$I�i���!��$���3SI�B�M6����S���h� i�$ ��	�A��I�i55=O��<SOP����C�@��=g$X��h���R I�J��`�S�+��!�_ i5IDQ��\&
%����D=d$��!r��b�Vm
�J�`��cmKU��
`(z������!�O��"j�Y�0��bU�M�����b�DTV�DPTD��Z�!�	&���i������5�kih�G������F!�RD�5q��?�����%DL�'L�u��41EaY�OT�EE"��"�LB��`�i�������
���'��bM
!([����y���������"��h�������EE50�UUPLEQQDPT�PQR�d!�!�`TEEs-�#FzZ�j�)`���EBNZ�YY*PTH0�J�H���2i()b�8�kQ,%�*�QUU���R+0�I�f�����&(��	��c�DHKE��EH/�2��8�MLJ�'����b�I�VCa8BKP�B
��HTI
�j*8���;�>�����?��C�q?���D������<�Y���a����&����J�����o�����3�K�����bZ,���]4���l4�������.L����O��|><��g�c�|�38b���?M�5+?���������]a���x�7��~:���.��d�����i�J�T�L]�����T��)��\���4����e�����<�;�.��!���93,����k�Cf,oL`e����m?�s�G�K��`f��s�-N�:q���-�%��z�o��a:.�]����"`�jc����yQ1�	��������v������3���u�����!i4�h[��}���x�����
A�*���`L�UK��c��S��c6L3�unY��GH�UQ��M�ETUM��h$MB����t������;�$L�oo]�!�&=yyo����������M���y�uvJ���&��1�
����0��|���+X�m�)+��aS+*�8�.P���|�)�������=��Q��K����mE`R���O$�ht���Mg�$"����4��CM�b4%P6a4�THw��?@���.z�)���sK?�"�c�Ri35������v�;9l�D�����a�cT
�Bm���X{��a?�����o_.�>D�	��s�&������������}�����U6c�D�����G��$6�1����d�o�U
��q���j6?-�����{0�j4h�E������k����E�jH>�8�������M����A������|?LG��N��&�5�����~�{�/~{!��T��?�g{w5����&tv0�`QLx/�������Hk�}'pxUIm4�\=��.�\-�vb�*��|��+w.�AB9�U�["�V�I�%99q����7�@:HwvHc���3p��p�
�k�bDW�6LRu�_@���b+���GH��tQ@�x��9���g�@��~�ERUU4o/�
�������}���=��������7�vc���=�!B0�������{7������Sy!��s��-�i�H��e��=������[����g��^��;�n��wwu�����'����*zg�@��]��G�������XT��hpA)3�J��8��()�C����������((����KB7����}�!Y�d����cv��g������BHZ>�t�Eb�ojq7zo���1GW����'�e��(���#-�'����-����}v����](<3�d��u<_��g��|���9�-}>7Z�.�S��C�	� ��C�*����*��7��)��pa����a4�����!6g�jk'�(���`{������~�������BO�������$S�����Q�&����G�{���n��N�.�O�P�H�m�r)�)���x�}�:�������/h�Cf2�@����Wmf���9���xg������0�0� ��{z�5�������x�q�V�e^q7�l);���i/f����.����x6w_q����FD�(�zB�@d,�\:��n4Md�X���J��R�����`<N^.�ur��:�<0�HV:�JW���L!����EQDA~$�,0�k
ib ��2[�D�Q!��8MUQF��J����3U�j��b����&A[h�EL������w�B�\wA ���%��'p�"�Z�s��5���3Q�V�k�M-Xe\++���w�0�V��$�I�����jS���vu��m|CN������OV��nZ���ks�V���[c������{���Srb
�B?�]�8�	0�q����	(�F\�f# ^�{G_�>c�|�EXW����@A4����'�"Qq���}�V����&�7��{��C�����
���C��n���`�6Y�z��vD��V{3LEG�(|�_��Sp�$�8wt���V��sk���H�T������=W���t�I�<��w������������ ���M�����b��D�w��5��C!�����1�q-&=X��lw�����5(4�E��	��Y����=
����+�T=��N���"�5����)��s�a/NJ"��7�����+l"VT!� 8}�����2��4O��|��{Z�w|�"��[��#D+�*1���uj�����Z�>%y,��4���cPVcu���MX��y�j1)4�s2�z�|�����j����H�
�nS�G��mB�+�gC��#D9�5��]Lm�t.�
F����"-����bvu;���%8�Dt�I��t�����|z=���������!4������3���t��p?oDM�d��&��'.���x�*8�!(0\G�E�9�	8�9&�2��E�v���u�N��n����C �
��P�"�B��y�I��?g�51�N,���������i���AD\��P�^�0���&��`�P�%	J,�C������49W�;�)ns=:O�e��
�����}������M������_.����L�3/?O�k5��3wz"$]�g���Tb�q�'���+#>��Ic��]��Nm=5�*�MvI<J����0��U���\���	�s+�,�<�JG��0}-����t�@���tM5��
id�y�G����������r!��!�@�6F]�#re�P	.��<i��oF��1�d|O{�������xT�DwVy�'���t�������%��jF�\��U����jx5���-F�>��wkFr��,�v|����4BmP��^K������x�Q��C#��;�
��&�P��V�5�;�H�O���y"�6;W�:*��U}�?=��1S��=Es��>.���+��Cf��5o������>�R����OZ��WY		0������:��O���e�O`�66r��rw6�����a�c�k�)��7A�f�X���<��4���LW���[�X�0��
X�F���������P:~zS�>�.$&c�y�A�1�����
���M	7f����i�>�h�bxEQE�1��(��(�i(�����t�����G�O��w���'���h����_���c�z����F����	��l��:N�	�6i��?h���~�����T���fry��������t��d:����(ox��8X0>N���{���L���ks��3���k��`������d�������9:�t�n2.�o�~<���i�A�`��%1��u,~���>�H��F�1��*C`$ ���IBP�_������Y9&<�,{/NP~��O�UN��q�r���r��s��^�����w��D���@��UUUQUUUEUUUUFr�/6iWt\�H�7Vc���dm��=�5�n�AG������A������#�z[�?p��^w����VHJ������/�<AH$&��i�,K<�ao������/[�������B�F����%�����%4����R����$�9m��/��%V�\��UT?�x���U��b�{
�$�Z�����R��x<����q��I�A[��a��@X7[a�3ex�B�oy���$$��
;�#��L@�{�����]UUU�*���UUUU]W����<�����'4��N�a������g�-��� L��1����+a��1L<\(��@�w�h����Hd&r�jR<2�7�C�7L
Tv��j�!�V���&�[yp3��.��r"�{7pT�j;����0_H��LN�\���J��Y���z��uF�0Sy��Q:�O�
��HT@��J��������}+�6��~(��
CMY�|z@��IcN�8,����i<,�Y1��UN�����a��V��\�?�Z��������}�h��L��T�����i����!�=P}�->6T<}�w�V��9	xa����9Q���:�k�l05����Dx���LM)�q�����wE������M����U)�UF�m��
�</�{��^������!����[6�������"�j�\����Q78����j���w���Q�X��>d<������o���}}�g���j5O���8${�~'!8OL�x��4}��RE��|��7?3m+c8�}�����%��_5_�����fl�M�Q���:(o�W��1<������z"MW��j�� V�:Hzc�*�t��L��Ex��
X�:��.WhK��K���bxu�UQ2���16��:���@�j/�����=go_��o�,���gB%@�&��Y>��[6��c?\%�������wA�Q�^�J�H<!��ZP<L����X�*�CC����Qs�FMA�hd���c�����f��3����;N�w+�?=��{xc�b�}3���������L���0`�uf�_�`��hB�e��%X���*hA�C�'�5����y���o��kKp���,D�+�
���q��������������[�\�e��z�Wu>�<��d:@�O�\1[�����>YL�����(�+O����0�P�|,�ow��
��W���5�S��|������x���mv]q0�b�6����q[{F�[���1Q�wO}�����D�*������N����>�6�m6{����"������S�f)8&I�&pL�?����#�~U�;�o#4l�UDZW�s���u��=�<�{������G����o��r�<���!��8Z����+���������b����I,o���LUV�s��T�pi���s�R���U�g��S��E�I97���9O���~J����*T�J�r�9�<o�V9yc4����l���Dfl����&
N���6��c��2���M�c�/k8�h��O}���.r&./%�U���{��C���m��2�Me�l���g��.�������U�Vd����ikNW�������)||�"���~y��a������z�����Q��2*�)�������t
���6gg	�����F�>&s�QY�v���J�������d���uE4�1�`�fb7������������r0?g����t�P/LS����*Sc�zP~r�B��'c����y�����
=1��������l�YB��'��U��o�}7��;�BE�h�R5&d��v���G^7J#X��������U_>~���������=�3��w�
�u�3w���Qi���{	��)�	}nV��D3�D!��C�-=�N�}�n�2��3��Q<��9#�#�L��q��9�hy��h�}�l���K�����*��'n��[��<�m�����Bg�k�iS8�\��	��V����;K��Zz|fM�y����L��Z��i4Y_<s��������cbm?���k:��nrm3��\����k��I�BP�O������+Y������l�oa���i���E�o��F������pt�+��e6���������-"�~K�F�x��S��m[F�/3r�������u��^��2O�he$���`�t�������U�Ex�4��u�i���_����)N��^J�\EQ|'%O��\�1�>�r]�wu�I��;�����,��~�%��>a����zShn�O)��f�j��������j�8���"��a[y�����L��Y=x�S������n�B���4�jA?:�o��q�7�te�y�
yP��i�)�gXX�C�$��J#��'CL������* �@V	�]q�!Cns)F��x_%|h,�u�-\s4���\�.
��<��fHn���pb0��5Pt�2E!�@�8����P
�e9<�p�iA���(�L8��98&���0F`�J%
YL)L,A��h���:�~������!	B��/6�c��B���4��N_n�,!_�����D������2����2�5a:��WT ����W�!�|� #q2�E�@H/Yq����^~���4x0�;���I{����{WG��cM�`1G���,��L�+�����2��G��������*c�{I3
�� Bd���x����L�$|=V1���T�S��i!�z�<��JU�f�j
���7�5��4��c��}��g�����|��A�u��<�"�`,�D�������[T��DR����0����.'�1���HNQ�?��$���#���SK�����z��"@v��=B��iu/��o|�9��"����"|}�kV+�=���2c�������e�L�\_����R���l��e�9/�_g���a����=a�K�r 0�"!b(��� ��!rPY��8��F�%�&��.�z��@I�j�L����>�&���2, d� l�`h��Pt�w���������$+4�?[�D;��=��������#u�����u��mOd��8�X�M/�Y�@����=��x�����T	7�O�JG�5��dY,W<[�����n�����Z@������&�v�hfC���o��IO=7n��%������a�xG��@n;����=�\�P�Jw���
QZ��D_���q(�������y�)��n9a���*���uR-��w-vU��R}���"���U;I}Eu�|�I32K�|~K���y!E���r%%��l����n�|��M���"I�[����A,	�
(��
�P�4�9j�h8
T3'eH���Af��Q����e����/tNHXl��*��^p&����%����Q(�[n��0$!�&T\������X��������t�i�q������������]s'��<����w���n{4]��
�?	�>���7D�H>�W�g�j~[+6_]��x�V<�X�9��>��,4��{2�c���J:o��{�	����"��T�UM>s�w5��Q	H��:����Fs���WwH���Ni��*��|�G������;_NONw�����z�\��K�KJ�dwE����fku��>�]d}�=A�Zi)"<���%�Q4���BD�E�4D�P�SQ15,UJL7�2�%�*��5��DX.��b����N�2� &�
�����&�������OpBh������u@�S3�c���6���	���.�/�Qv��DJ�R�v�$�v� C�()J���V���{����-U	����0l����������#��{Bb��}|<����	��S�|�����5���#����h���f�O���Eq;mz$|��>��Y�����%�>�.���m��!�Y|�9vq0�1�����/�����-�=%�
�6��������k�#��5L���\�0�s�����T�7%^�+�,��������Nb�5�l��j�
����2gs��^��j�S�'����� QdW�~�R$0���WS��2�����A���%V���x(Z;��E�j�&�h�m�Cc'�����l"��\��	������H�K�N
<��i��T��6�d%��,��������d69�	���<������li���k+�N{�����#_gS���[4�`L��6�i��F������������Rx�U�8.W��L��3s3aH�T��9P���$���*q
��y*�w%�$�3&-z������R�R���X��R a_����������!�����a����p+ ���
����E���~��d���i/������G��x%SyS$���j���!$�M;���]���l���z��
���U�C%�SbB��C�����v:������"�9��/���-��e�Gemm���d=�|<�r��V�c�������]�~%�`e]����;����q����+1��0a[���kR��Zc���W���D?���.���#����Zc�3;�W+j[}g����>�=��v���f��s��1��$~�
�3�y�'����g$~��k��i����5�x�&�i|�?���#��������B������ �&�O��I1�$�a�P�I;�	�KmATZ���`����I�&<�.-QB�u�O��e\�x5��7�t��?Tfz���y��ljT��q�����{Y{��S���R���{�`���4,��^�����Y�Sv����w^~�Z�od��N��p��xP�H� ���=f
}������UPP�4Z��'��=a��:>{�7�
��?zaprW�B�.�&���l1e�w�}���#�=a�<��AL�����	�g����DDDQG�""""""""(�������	��w����>�P�O�>���g�3\�m�JQ��?����z`Bf?��6�_��8��P=SZ���(��
������(�o����r����35�C��J��e$���0����S�}�?�;�?�����W�r���S`���9��7UU�w5�����N������0M0��(�e��*�#d<�wy��1}�+�FCR�n_�-�7�Am*�v���X\�9,�-��{(�(��YYiI)���������Ej�\<r(��G
���V�{���,XL�K��i�
���l��[�Pz��
��>��l��uC$A���"Q�A�(dE/.��1��o-e����m&���6������-��M�oc%E���:t��
V�BP4:L��q�w?*���W9��[�Dz\]L9�b_��b������f���X��z��(��>R!DaR�p����{�����u�:�����=x���'�xQ���N<�����`���3�4�n�d<���9��i�\x�y���w �$�DDC���v;� �n��
��-m�3x�����Ll�=���Q�Gm�R5@)H��M���
P)J�WJ|��H�S9q��8��fo���r��!�'wN�SM�dh�YnY������f7lR��uS`�R����heU��3a6h�+7Wu�LB��Q����e���5c��pv���.W���'��2b8�m����V�~���N��jZ�K��mW���1d4Y�Nr����1��\��2�6�l6@�zZ������4H�U�f�3� ��4�X���R�rj�[n��f��!�I�k��k6�3�duF��a�;�>Kl���eo)mq�o�^b45Xj��Q���i��^���1�b��i|4������Gf�V���5���^�5������^��Ln'���:r��������(��G���Ur�d-���>���������`����SP�"�4��	lt%����M���������n�]����ag�[��QL�hE1�$��[�����\�AW�<�:��z<�W�eOe�<��T�&��rbCr9���b����sy������p�g~��}0GiP���a��%b������=S��.���i��XCo�Z1������k8����l�/������a���&Z���������|j&]P�&4�r)C$������"��U��4���T����_>�5~��q,$�kA���������HM>�����S���)�����\�C�/���RAU��$z����[X|��d�6�%��z?%��@��|xKS�&�qW�9f�?^�8�w���8%|�'��
*��}r�Rt�e8O8��1�����Q���������	��|������8$9�a$3�m�)
&�@�!
�:��C<�zF7���fh<�x�$����Y�
��9<����*�`�����l��by���~����C8ScY�ICv("K!c-,�V�	
�A��n ��Q
��yhg��I����
�=v�hd��<{H����=f��@�������.*d��PCT�$�����?���A(<`�U����:��u�����Q����u����NE����"��Ph�P�@��S����s��C��x��j
���#���{��~�e���:
�~�����X'z	�����dQ'�6�!P���b6KO��8�����|�"D�A4���-���E�@��I����rN*���n���F��M^
�� 4�i�����:�PJE�!QVB��W�2����h1@�P��_��Z1��+�G�1��S�&g���&�������S�[�����~�@5w��U�r��#Ccg�
��D�d�<!b�A@n�(����)e�I ])�����D��!d�a3�@=��C�AE?�Go���������]T��4���4C�}`�iw��T+8�K+��":W@��������G8k��"�P��.�=j�y��M:����`a7Y�&������	&����'/y����2��H>35.��$����<������"��\o^VJ��:�����&_jv�������]F�'�2^�����`���V�{NGD:'���|4N�1H��[�d�cAp���d=c����a��������4%*a��4����eD�-J��]����P���%�`Z��=�aO}����w��?
���_�����oa��9��'�4z�������[�0��wI(�3�����.{@=��%&�d6ASS��Ph0��
�6��P�I��w���^��x�gr�JS3r�>��h�����A��m����{S�0�
�9��@�{t��� �������Fn��
�
T_�;�DL�J���Nb/<�,0�ALMaT��Ir�K=d����M��{��������)�C�
z������:����E����
H��e�p��'��>��L����L��������bOl8=uT�_O�����>	��%��zN�O������`\�f���4�=x�<����i�SS��bCaE��/�6����OREp6�����0lG,�_<�@Vt��
��Pls�E�M��pa3��lSC��#AS�q�m���(��Q�z/v�!GP���6D����s"��� jR|4�`}�|LQ�LtL�z�����^����4�(��
��^�B��!P�P���]�	��4@!m(!j���
!�O�z����|<�������
�Q�5D�
&l/��uu}�Sq���y����T��1�c*>�����S�VBev�L����Yi�(�_�7�������L����Q$E�����������i��C&���r1��U������r4�ZQ��������jfTr!P������oC7LM!T2���$��D�B1�6/1�sq3b�b;B���<�I#��zU;O��'G��9t�<��gm��<�����-<"��\Y���;�60�l@>R��.*:0�O�y�h zx"C������eGQ�U�����7����3�#�������#pl�((�L��p.(�~0�2����1!g[���{�=��z��h:b����z����������XS��Y/���'S�
*�E;��TCP� ���}Y��Y���g��?7��/��
����jHA�h�������� �����������������$z�C��XF-�P��
�h&�J���j�59�c�,/E��wZr��l!�q�Ghh`�V$ B��6r�	2�F�e]�;�o��h��Q7���������6����������;�����7,1��0���`pq0A��~?���^�/���='J�U��-��@���i��3��p��I���\c�l5\@��tX�U�"M���xHE�����({���}��(�l�(IR �L�!��D3PB80!��"�1~�Dv�������93��j���@j 4���%0X�x~�c/���s�l�r������T��[�� �qT�
��wOU��Hh1!#���:�9�\���_����Ka�G����/�����B"b�+�.@�~�@]���/Nq1��w���h����H��@����?	����C�0�8i��h5�^��a.��[��>t��aRId+=�ZQP��d���� �#���A��?��)Z7��s�:�Q"@��B%����'������l, 9�������*�6cog�&{�o=�S����5���P�,��00ae�@�a�y)�}7A�Z4�z����bZ�v9w�L��������(�q�w�M���|�:��G���*��� I�V�����B-5h'%����v�=G���)�=B�EM'��"��8����d%bt��[�(�a�IM�1��WbE�&��&�F��� Qf:����s�]������R���0��L|�NR����v�j"���*hO�?���=���xUT�e��x[�/k��5n
09���1������O"u��#-$�=��'�=?v
ng9c���f�TY.�*��c�m�����\�A"L��0 B�+x�������Wq�N�mA@�+'���@/���e������{#
%
�����r�������BDNo������3q��#����3=���P�:{�����]�^=�?�����(�n��0����A�������u���!{>��h
��@���o*B�)7��3C����}�;�
`���*�i����~���s�L�!��+����p���p��Gb@-��?���$�����\	Mp�-�{���~wo��)�A���K��JGG����*Pj��a��I���
����s������K(�Q`�M�����l�}%UC�_��n�Z����nY�#~j��q����A�nR�F�n��������:w�!}v��>�s�
�D�$��rd�VNV�����wa|8m����z)X)dW��U��O�Px����p(�9��P�*40T�E5P�:���j���l,���!�,Q���D�d`S��w�1
b�������	���a�?��fi�NZQ�^_uV/�2:IVjK��3Y�l<"������$VM�`m+����/g
f�nXj���A�tp������Y�������E8������qP��2p�;���R��l�������Zj���N���Q���(@A>���������8V�N�����P��N��4
d�)��,���0�������S��P��L�w��r;�O�N�X�&��K�@�e.��������������?G�a� ���,&�6�z��$�j��D�I��'v����b���_����������F�������O�~��=�3	�.��\!��:
����@rb�L�gi�>.����=�;��<�����P�g0��v>�FACa�=B!VA=����>yn���v�pq���5�a���(����l	�-�#2d����iSb0��5���c
}U��� ��6�0���gt �a�KS;C��!q�
)��g+�E�V��������e�k*ogr?�bT2����������������D.h3����zb�8w2M����F���N\_a����R?M�\��$�r����	Y�-�<b�
�\�Z��W�������(f��Z�:����u�g����a+@c�;���2h!�N��D�+�.��V����jt����,�r����(�Z���/�v��!�l��d�!&�f����-����L�K�-�����a�0�@e1��i���He^��Eb�6��NlJ�*s��E?CZ</��"�,<��P�����J
b9b��qM��>��X���Y��WcH��B.���������
	�M����,8��	.
f��i�9�0#d���X���.��;Y����To
��0=�* �be:���!�����5�>!vl+��mDDXJj�,�w)�%;�@����q��z<z�����&lR��\O
5]9X�a�4,d�BQ���|��6��2��2��M���-���������mW.��`�h��3#�E�?<�G~N?w�c�N}�*���+o&X��A�m�|�d�p��V	1]	��p\b�3#9,6�C��
7�d.�p�a��S���
'P)!�����-/f!f��6R(Tz���s@�%XHa&!�Bvd�(n��Kzo��^���a�t~����?9���� ��S�K�N_�G7T���z�F�!���'�f������3Z��G}�i3�
� �F�I5�YT3�=�?:!M�����*hW��	f`�h3��Y1�6nB:N���� 
JJE��B�{~2����� ��tX8b@|�ib�B(zJ�[0XZ�]�M�P�xf���0�-a$�/�d������RK�
40�(E(���s�W�*������i����+�������?L$B��9l�q��8i�V�$g��Hq�~��d�����P��i��Bz��"F�9���9s���o��>�-D��]�6:��8��������/HkC�V����.�N����������������e%$	bA����LDd���pU������
�����s��j���q=��Y����w��D$W�4�������P{zM�`������!$���dg����C�dI2G��S���l!�����l�s���v!�5-�DQ�9��q����nk��$���$���n��;%��}++�~���r��IA-l7j`i)��$�l��C���,����M&�<92{6�����xf�Kw�bm�2��}�U���f����
�C2�: g�<������u�����w�~�\%C��)���4l T^<�*m}__�V��.����\����� ���mK6�8��Y9�#��WuB��� �������.K����J0�	<!�����
*	/���uUtJ��f�y��r�����t����QRIDE(J4� R��BAB��J!)"�t'���x�2�P��@�"�`<ZD�!��>B��t����?���dTCv��=��@���R
���y�"
I�}D�����|���~������������Y(bQkejv� ��IK�6�TH�)D��2��I���H����J)}(�d~2��J��k~"��o��� �0���);&b�qo�j��/8� �A�RH�C��W���!��wL��p��3�@� ���_���]F�-��j��.�C�������:D�P�dA�y�3;���Sxg�K�F#p�)
�
Ax4� #r��7�
K��m5RPY��0�ywQe��Ud4e�deSS���[�����P�@n;2��H�����'(#s����9�����m k��t�D��P��5��Q1�"�PRQ����R'�[���O�����w�IYE
)E
�J�!���.�;��oG����9���_Ndx����JJ[*U[1��z�����=#��'k��i����B"�Sxl$��!.��L*����v�lH�u���#�����q��G�~9� @��[���J@�A=1L� �
M~�0��{�����xq�U#]h#)����u7*2�g���J�p.�g�����gR�S�+:�G��� �����	H<�G�$bR��&@U@��|o�0�n�@��m6sA7�������G9�CK�����$��o��d��t),I�ST�~7hk�?xV~�s���(NO�ybKZ��<%M��NW.��*���
"�H	�Y�q9t�}zcI��`���K3�H�"��
L2���d�<oAr���A�c>��';J�a��C�2�q���~�&1�4�Qb�G�T�����������n���J�wa���
b�V�IV�X�(i(9����q��;��#��C"z��$ATE5@�0�x��Xl�:_�����OH����P'����L6��~s�bd$M$�%!Qc��w��D��G�A�+by�2'���z@���Cu�!�
��*����89������1�������Q��7-�>���E�dCW�P����������];*�N�&VMO<�N*-0H�
@@���>�R�Se�!�.f���3��	������]X4 ,'��Bn�!�=���z������y�3i����:�V�)����v8YFl�i��b"��:qp�-�����)�,��91��Rh������P�Y��HC i��)%U
��/5	� ���$�"Y4EXv�:��"�$"T�2�5�B�Zz����5/
$��XBS�1XR��!��"0#X�d�d2�c�
��P$Q'��S*	C�Cp�&f�q$�>32#DaPH���Z"��'�IA�-�,�H��^����m+]XsF��h�P�.��"1bR���=%D�A$I�4���o/h`5w/1�6��IP�l<���0N�i��!
�Zg�
�(���d������:�;C���JL�R�����
@�����F	 d$�M�#r��{�<�(�����p)
P��Sg�hx��@���lGn�GFrV���w�;"`�a��Db���h-�-���
��j�%fxat)��g���z4P�D��H��l�(���f�/���"p�0���A%
F��%�����
M����U3YgSH���r���qb�!����-����C.��Pp�L�M�4=<�=9�`�@�7�z��"b<�rh $��<��,�D!f&��D��t_\����p4On��\
���[y?g��1+RJ�q8!����Y0��Fbq[.�f2���2V����xm��J�*��3r���n������;�����aik9h�j�1��B�_�L�p�j�l2�;?���Jv�"�d8�#��0�%����*ds���&@_}�B�.3��[��G*)\,Y���
�6��vvHD���h��%�b&��oe�e��L�
���t���/���wn�`�]����2�e���2A��><
!�|2��5
i�x5�I�&�%B@�/I�����e�sna}a|BE"�Dc"P��Bv��6��������������S������d
��+
Sxq5.�PDh9��i��V�]�xGXp�~��9��[��9��ZuJ�����{��_���A����09�;�N����B#��K�[{�o	���!yD��	�M(�]�Z������r�a@;�
��v�F�%��Vcm��L��������a�(X��
 ��HN�s0!�O�2���q�a�B��U
�!
X�xvw�>��7]5n�5�cE���
���"nLCO_�mO��!��Aa:��'M�()v���RN���V@�;,?E�!�*�,b���a�c j���{�^�<�H:�����V2=��2�a=�q����M������5{���(5�
H� T��u��
���z���OD/j���wU\�W�Ie������?`[��L����Q���~3�
��3�$�

	��n}�n`}�;������9��w�H�
����Tf�N;��*�.�L��:���"�v`K�%HH\S����j���U�>��}���	5�=���:E��
B�S��BC3�"���i/
i9�zzh�������4����a�'rQ�}�z������CQA ��P
%pe��|��wM�����	���^�Ba�����C��W���C8�)�{����Y�D��5�.�8B���v89\���-�u��UR
�I�Fx�f�(��z���j�GW����{��$��6hQ���2�h� �m-Z:�n�*�A�WY��3�e�K�Y�I��
.��
|���'�J���
[u��AMh0�pQ���g8�_�L_��B�E@p���O�B>��$ �Z2�)���s���w���>� t�$P�a�'�b��I��'���
���`��D6�SL@�~	���8�9��
M��' hu�R��������y�heF��L�6BF��J"<�)��F�0	��3PGP���9(x@����6.�����R<��t��������������d�/��Z����8��0�V�������������-��a���T!��4�y������
{������`�����,0*�����DF(k(,YV=���t0�3L��3�A/E��V���b�&ZY;��M�p!Rd�"W��R�&�5���,0,���`B|�!�9,��n_��fm��Li���5� ��
Y����`��c�l��AL�����B��8�n<����u���#��1�$�R!����������'�L����P#����~2�>,��3<� � Wi��Y3�9��������Vb��2(,b����6l�N��q��G����vB
�
o ��3�'BM(d�v"���C�������S��`3P��8���V���=��m]h��c�M�����
�-\;-��b>�0kL&�����+b/��4��q��v�`�	�3��a���� �;���#\/��oJA^�c�MIy��w>�P:��d�!$<�S\a��;�JH��������	��>�������$#
�#�u�D����L';�)7Y^$��[������D�O�Sy�6 �YH!hc0�F�Z\B0��q���6`��N�d80�g��!1M�!����/I"�S�A
3^��*�m�B29��������!��t��l���)��P�(�$
��
o5��*������u3SB�0�AWfv����0�����?L�	)+RM����qn$=����6�����a����� �P
|�;�;�����s28��E��Yz��Y���oc��.���KS�BO�&K<Erx�q"��5N�9]���������7��zq�fd��6��Z�+��g	����\��4��)@�0���s�'��Xi�
�UV��wE�ss	E���j��Bm#��$0�4dw&e��_���~/6�����^��)X��������`��KqU���_v��M���g��HK$;�Plw3x�<�f���X��Ve��N�P�A�;e�{��+�"	#���l����r"U�;z�t�/P�	��&r�mZ�O�|�A�A�G����w�)���w���ZU�n�Zd��Cx\!uj�X���U�q�F{O!���i��;w��??R�[���o%y����Q���tSI��D-��5tY�����2�XD����c��C`��V���>����=��:~D��SRB3�{��9B���o�F~�P_y��
(F7�6�'E��v<����t'N�!4x;��Q�������J�0����vr�	*�����o	�"(���]�����y�r�n��� 5�{z������s�g�9\����^�L # �v��{6D�\����d���H�6�0�0���\�.K	Q���j�R4�L@T�P��1S)*�O����A��L�L�K@k|{.Q���Y�!r"����y��Y)z�w���5��XL��D���|)��c���-��v�5!��W����`�8��!7-"�
Y���aU7��������kP;H�����{a���f�cC��\���k�:�9/�}����0��T�;�T��q�9c�F�f�+`�w��6�$�#l����^S_F*�n�'LX�+������O75X,�������F2!&�D���
�I�JI
@�(4�N�d�}Qx71%q���gT���x�%����-���e�i�|��U����::��-�^7��NK��s	��`������	9�c�|��3�����th��2��������&uo����@��
#H�
���MnI�d��}1�N�	jlO��N�b���!���(,�l	�Fv;CH����-��;����l�I10�Qs����$6V;%��[1�#
 `�@��le�d��B�;��b�e$�hxl�!�YC�!�<d��u��VH���V\�UP�VG!!�v��'D�������-��((9gT����$������mT��d��k
a�DD���E��0<!]$8��`T4�@6fx�F��A�?
u�dofVe������u��hU��4�t	�`i���N�Y���:�<���k�ZN����v���v\� �G�������'�	�����b�� ��Pb�i2@"b2V7��GM���IT&(��c@�a��HB@��-y|�Zo	���H|	����4���b5�|!W�@��T����?j]�N/� ���
����?U��#�c�e��;����=r�a��
"�+N,4D4T�p �Z���R���}.3-EV�V�b�r�(�T�J���JV��Bh�)DQ$MGn �7�-C`w!���_������\�tc�>����W|�IKET�3����x��s'� �u�T�@�j+�����t;�M�h)�B���]1{#�Z.rT.�'BnL�
�&j�
s�2.���9���d�'����0��=�[H�$�!5����rX�NS���Nv�C4UiO�y���u4g�a�%��R�����tK����L��dz$�����ml7��������I�z�������D|\��c�!����ATMP�@���l!�~�������C������ � p�p�d�a�
E�aHe�>��7�}gX��m�P@oD4F�B'�W�������u��V��H�u�r��>���@�����eR�`��]�1CQH���5�q��#�w������5C ��/s�N{�E��m�8I>3��(�@�Q�o�=�&��~d���{�hrp�������
r��3!�fj�����h5��Q*�*~L�v��0o�mgtS�y<,?���������3���",Y33\0�����O!�B��m�wHmX�=2D�:V �f��4�!5�#(��4�������[������e��(jC��Go><3>���1|��+
#0��y�fpdO�@-��!�����������:C���$����!��;,��B����!!  ���"bC	���h@�ZH�T��
�H"	"UV���>k��!���zf�I%��PSh���W	���-
�@PH�����
��  ~��� Y[!M4�4.�30S@A2"+>td����`	2JM���Q)�$:�2k	�Lj��1�9����7'�!���M0'�(E�`���;��9��o"���(�L+mS.�eK0:���8Y4b�����X���`K��N�!�x��������`� Z��K[��a��X}��0���}�l���K���	�`HP�,�9"hjA�:������A���OB��}�fP��/�ax8�&8.$�R��o��t�P�(pm�Pt)������rE8P�k�V_
#22Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#21)
Re: WIP: Automatic view update rules

Peter Eisentraut <peter_e@gmx.net> writes:

CASE will be quite bad for optimization, and then you might as well go
with IS DISTINCT FROM, which is just as bad but simpler.

Definitely avoid CASE if you can. Although the planner currently knows
nothing about IS DISTINCT FROM, that's fixable in principle. We'll
probably never be able to optimize CASE conditions very much because of
their special evaluation rules.

regards, tom lane

#23Bernd Helmle
mailings@oopsware.de
In reply to: Peter Eisentraut (#21)
Re: WIP: Automatic view update rules

--On Samstag, Januar 17, 2009 02:01:15 +0200 Peter Eisentraut
<peter_e@gmx.net> wrote:

* It is not clear how automatic rules and manual DO ALSO rules should
interact. A manual DO ALSO rule will currently clear out an automatic
INSTEAD rule, which I find to be illogical.

My intentional feeling was that it would be a bad idea to leave any
implicit rule when someone is going to create his own rule set on a view,
at least to avoid any confusion or side effects. Consider someone having
his own rules upgrading from an older version. He must have at least his
own DO INSTEAD Rule, it doesn't make any sense to have his own DO ALSO Rule
without an INSTEAD one. Thus, doing it this way will leave the view as
expected from the original setup.

*thinking more*...if we teach explicit DO ALSO rules *not* to clean out
implicit ones, we will have the following workflows:

a) View is updatable, has its own automatic DO INSTEAD rule: if someone is
restoring his old update rules, he will have at least his own DO INSTEAD
rule. This will drop any corresponding automatically created rule, adding
his own DO INSTEAD rule and any DO ALSO rule.

b) View is updatable, has its own automatic DO INSTEAD rule: The user is
able to create any additional DO ALSO rule.

I don't see any problems here, as long as the implicit DO INSTEAD rule gets
replaced.

Opinions?

--
Thanks

Bernd

#24Peter Eisentraut
peter_e@gmx.net
In reply to: Bernd Helmle (#23)
Re: WIP: Automatic view update rules

Bernd Helmle wrote:

--On Samstag, Januar 17, 2009 02:01:15 +0200 Peter Eisentraut
<peter_e@gmx.net> wrote:

* It is not clear how automatic rules and manual DO ALSO rules should
interact. A manual DO ALSO rule will currently clear out an automatic
INSTEAD rule, which I find to be illogical.

My intentional feeling was that it would be a bad idea to leave any
implicit rule when someone is going to create his own rule set on a
view, at least to avoid any confusion or side effects. Consider someone
having his own rules upgrading from an older version. He must have at
least his own DO INSTEAD Rule, it doesn't make any sense to have his own
DO ALSO Rule without an INSTEAD one. Thus, doing it this way will leave
the view as expected from the original setup.

*thinking more*...if we teach explicit DO ALSO rules *not* to clean out
implicit ones, we will have the following workflows:

a) View is updatable, has its own automatic DO INSTEAD rule: if someone
is restoring his old update rules, he will have at least his own DO
INSTEAD rule. This will drop any corresponding automatically created
rule, adding his own DO INSTEAD rule and any DO ALSO rule.

b) View is updatable, has its own automatic DO INSTEAD rule: The user is
able to create any additional DO ALSO rule.

I don't see any problems here, as long as the implicit DO INSTEAD rule
gets replaced.

Someone who previously had a DO INSTEAD rule to effect updatable views
as well as a DO ALSO rule to create some side effect (e.g.,
auditing/logging), will after the upgrade perhaps want to rely on the
automatic view update rules but will still want to create his own DO
ALSO rule. In the current patch, the creation of the DO ALSO rule will
delete the automatic view update rules, thus breaking the entire scenario.

Considering that the updatable views feature deals only with DO INSTEAD
rules, we should leave DO ALSO rules completely alone.

#25Bernd Helmle
mailings@oopsware.de
In reply to: Peter Eisentraut (#24)
1 attachment(s)
Re: WIP: Automatic view update rules

--On Samstag, Januar 17, 2009 02:01:15 +0200 Peter Eisentraut
<peter_e@gmx.net> wrote:

Here is my updated patch based on yours.

Outstanding issues, as far as I can see, are:

Critical:

* Updatability check must reject views where the select list references
the same column more than once.

checkTree() will recheck this against reused varattno's within the query
tree and will reject such view definitions as non-updatable now.

* Various scenarios of REPLACE VIEW misbehave. I have marked these as
FIXME in the regression test. I think all this would behave better if
REPLACE VIEW dropped all automatic rules and reassembled them from
scratch for the new view. The infrastructure for this is already there,
so it should be a small change.

DefineViewRules() will drop all implicit rules when REPLACE is used now.

Important:

* Array support should be clarified. checkTree() appears to reject most
variants of array references, but other parts of the code try to handle
it. Should be cleaned up.

I'm currently working on this.

* It is not clear how automatic rules and manual DO ALSO rules should
interact. A manual DO ALSO rule will currently clear out an automatic
INSTEAD rule, which I find to be illogical.

What i've done so far is to replace implicit DO INSTEAD rules only, when
the new explicit one is DO INSTEAD, too. An additional DO ALSO rule will be
added to the view without dropping any automatic rules now.

Optional:

* The use of must_replace is create_update_rule() seems a bit useless.
You might as well just always pass replace = true.

Fixed

* You may want to consider writing the rule qualifications

WHERE ((CASE WHEN (old.a IS NOT NULL) THEN (old.a = vutestv20.x) ELSE
(vutestv20.x IS NULL) END))

more like

WHERE ((old.a = vutestv20.x) OR (old IS NULL AND vutestv20.x IS NULL))

for better optimizability.

Done.

Please note that i haven't fixed the regression test yet. Thanks very much
for reviewing!

--
Thanks

Bernd

Attachments:

view_update_20090119.patch.bz2application/octet-stream; name=view_update_20090119.patch.bz2Download
#26Peter Eisentraut
peter_e@gmx.net
In reply to: Bernd Helmle (#25)
1 attachment(s)
Re: WIP: Automatic view update rules

Here is my latest reworked patch that fixes all outstanding issues.

Attachments:

view_update-petere-20090121.patch.bz2application/octet-stream; name=view_update-petere-20090121.patch.bz2; x-mac-creator=0; x-mac-type=0Download
#27Jaime Casanova
jcasanov@systemguards.com.ec
In reply to: Peter Eisentraut (#26)
1 attachment(s)
Re: WIP: Automatic view update rules

On Wed, Jan 21, 2009 at 11:09 AM, Peter Eisentraut <peter_e@gmx.net> wrote:

Here is my latest reworked patch that fixes all outstanding issues.

1) there's a regression failure, it's just a message that changes...
attached regression.diffs

2) this comment on
src/backend/rewrite/viewUpdate.c:form_where_for_updrule() is no longer
true
"""
/*
* Finally, create the OpExpr node, as part of a CaseExpr and
* include the OpExpr as part of the Case for managing NULL's
* we will do this everytime. That way we will have no
* problem with:
*
* ALTER TABLE ... ALTER COLUMN ... DROP NOT NULL;
*/
"""

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

Attachments:

regression.diffsapplication/octet-stream; name=regression.diffsDownload
*** /home/postgres/pgsql.viewupdate/src/test/regress/expected/view_update.out	Thu Jan 22 02:17:54 2009
--- /home/postgres/pgsql.viewupdate/src/test/regress/results/view_update.out	Thu Jan 22 02:25:13 2009
***************
*** 40,46 ****
  INSERT INTO vutestv3 (a, b) VALUES (6, 'six');
  INSERT INTO vutestv4 VALUES (7, 'seven');  -- ok, but would be check option issue
  INSERT INTO vutestv5 VALUES (8);  -- fail
! ERROR:  view is not insertable into
  HINT:  You need an unconditional ON INSERT DO INSTEAD rule.
  SELECT * FROM vutest1;
   a |   b   
--- 40,46 ----
  INSERT INTO vutestv3 (a, b) VALUES (6, 'six');
  INSERT INTO vutestv4 VALUES (7, 'seven');  -- ok, but would be check option issue
  INSERT INTO vutestv5 VALUES (8);  -- fail
! ERROR:  view is not updatable
  HINT:  You need an unconditional ON INSERT DO INSTEAD rule.
  SELECT * FROM vutest1;
   a |   b   

======================================================================