ALTER TABLE modifications

Started by Rod Taylorabout 22 years ago29 messages
#1Rod Taylor
pg@rbt.ca
1 attachment(s)

A general re-organization of Alter Table. Node wise, it is a
AlterTableStmt with a list of AlterTableCmds. The Cmds are the
individual actions to be completed (Add constraint, drop constraint, add
column, etc.)

Processing is done in 2 phases. The first phase updates the system
catalogs and creates a work queue for the table scan. The second phase
is to conduct the actual table scan evaluating all constraints and other
per tuple processing simultaneously, as required. This has no effect on
single step operations, but has a large benefit for combinational logic
where multiple table scans would otherwise be required.

Steps for the table scan include expression processing (default or
transform expressions), not null constraint process, other constraints.

The code has been simplified a little. Simple permission and recursion
checks are conducted in the common area and an enum for the command type
is used rather than a Char.

ALTER TABLE ADD COLUMN col DEFAULT 3 NOT NULL;
Allow creation of a column with a default (filled) and not null
constraint. This is internally subdivided into 3 actions much
like the below syntax.

ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol > 3);
The above combinational syntax is commented out in gram.y. The
support framework is used in both the above and below items, but
arbitrary statements probably have some issues -- I've not
tested enough to determine.

If it is useful, it will be submitted at a later date.

ALTER TABLE tab ALTER COLUMN col TYPE text TRANSFORM ...;
Currently migrates indexes, check constraints, defaults, and the
column definition to the new type with optional transform. If
the tranform is not supplied, a standard assignment cast is
attempted.

One issue is that it detects dependencies way too late in the
game (after the TRANFORM has been applied). I tried mucking up
performDeletion to have a RESTRICT that did not throw the error
at the end (or physically remove the items) but that didn't work
out. Any bright ideas on how to achieve the NOTICES from a
failed DROP COLUMN earlier? Otherwise, I can put in single
object detection at that point.

It does not migrate foreign keys yet (should be easy to add) and
will be forwarded as an independent patch at a later time.
Currently foreign keys are rejected like views, functions, etc.

Comments appreciated.
--
Rod Taylor <pg [at] rbt [dot] ca>

Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

Attachments:

altertable.patch.gzapplication/x-gzip; name=altertable.patch.gzDownload
���?altertable.patch�<is�8���_�dk�$m�>Wyd'�G�J�LM�N�`���5$eG�����
�)JNf����JlG����h�:p��S��v3��������7���x��[O`������x0as����}��o��C�5�0I�H~���}�������^��GQ����"�]q����
�>8�<q�����l?�W�A�������:6��Z]�j��O�Gl�?5e���ax/��{���i�XA,������-F�_;���0vq3�����7W��l4�����^�"��-p@f{<I^>{w1�x{����/�F�s���~p�s9�������������[�����d:�L�olp1\\^�_��_	�"<����c�u���t|1����>�[|�@�Q�0���0�_�+�f��)��zu��f�{		 ��`>~���+�?��h���on*����u������ur����q�0���x���0�s�b���@@y��������s�P^4��;���`�.Q���4q��%�'���I�8,�$Yl�L|�~�	+��]�N�A3�E,[@�����!9P���hF<����E�s���U���=��Li��BU^.�B��?���E����&����q�������M���K,u��I�W�#+����F�
y�d`���g�A���
����}����Y)��V0�JC����=o����`�R9��D�L toBNM>�E�I�"����
0KVQ��/_KH9�����\X2��s4G�����J�sx
|�y� 9BC���X0��F�|�� �5�L)��ch�r����dUrs-�
�����1n���.�R�A<����x���F�]�5�mV U�c�k�6�X-�������I8����@�
/����?��wx����>>�
��Z4���������$�3�A��d���&6�O��'�K��F�)�)L~���@=�0U)2������H���+����p�X� Liq�b����������� ������	qF�r(�q������\yw��I�P��Z�&�����x4���U;\��2��E9e]=�d����?��k��U�K��T�����L?���L�h����Pk.�G6�C���������U	i��&��
C�)����c#j~�8�Z��#���_�*3��v���Y�4�76�TM
��3,��<x#�����������$�%k���[�������
TR-]ET�t�jH�]��K����J��k�q]�F�6��b��������^���]C�9�����U47)�U`#B(��l@��*����sOA��*��IP�U�`�����M]�����#��K�}���ZZz^`f�
V�,Z�$��O��:{5]_^���\N���Z�0+��#��q��K���.lBU��q���z���v�S������|+���Vb=��L���u�v;;�'��J%�P�A<�uB.��V�3��u)���������Da�I��d����bD���+��%X@V�V�u�#����"2�_�4�:��h\l�p����5K��,;�������+T6��[Q�)�P{�H�d�?�d�b]����BL�~0���2Dm���X�h�C��Sx��d����/yh/_Bl��jxy5�<{w=lH��y_�AQ��h�%� �j�I(������RZ[�K���A�(Q�3�tU
��u�?�AV&�6M
�`�
���*Q8��
TL����"J@���rc��R�t����$�k��.��-����gU��9�]4+��!�l�F,U=�o���HP%e�|N�������XI�P����A:b�z��B�Y2�M�� *D��*��F
���W+���NZ��T��	�O����g�=/�1���hr�za��>�P�B*s����#�o���8mu�;�n���w�������Z�o�����?�`�y����F�����n����i�u-�u�������pf�@�@���������&Vu}7��������N8F=H���F�8�����E
���4:+�Kmc�=%��!i�������E5���9>����.p�^����=���h\�%0�Md��
�H�w[K�S^.a{���}��j�wz�:1D���CQ���n(F�����.H����P��T(��b�\���Jt}�W�
-��I�ud�tw��$
cq�����DB��W>�.�#�!��5YG�:�]S�Im�d@��`�j���yYZ��0����q��q�"Jc9r>���$I=<��P�t&5��p�ma@nx���<��������oL6@���yI��
�S����+�>��2?��+����������;����i�D}G�}~'f�M�k�i�~�m������`
�aC>a<$7��.7.��������v=W<��������,,r�����8�.�D��B��|��R�y<B_��Yi1	���4���Go,��p+�����$���nb�����1�xm5���a�4�;�������,�qf!������>6�d���vY���u��[��>p���h�!���|L��,U~o�M�X�KA����:r�-�r�P� �y@��'A���@�Q;�����H:��A�A@k	�2'�2��r���|OP���gn�P*@F��]��3S�UrU��;yR��(���e��-�;&r��)Mfi8SsQ+�0^��K!�f���z�������o���N��I[�����B/���qEDB�������.a�b���[��1�eZ�\��7����@@����Xg@5�gm_�?p�w��W��bB��N�����z5w��&F�-�����w����+C��uU���;�[�����kp�[c/��x�?E��S�}��cz������i�N�&�@���x
|����tt1��y�{�8S��"�TNL2h& ��')�3����H�=W�^����E��`C���g������h��,!#{�0���Q7�'����6��l&�Wi�~����3�k�p����OeH�A��U.��t�so�z�Y����>@���d&W
�����g��8@��i����p��'��B{�"�5��U�3��F	(�xeC�H6���IP���T+A���Q��$^G=����	�7(��$V:_����|r�U�5��1�:��� �����Am��'JPz�Q=\<���?��d��Ecc�i_�}�����	_��a�H������%i����C����|�%���k��<7�KP���,E$�p1��?r�}���U�K���{��ef�gK��	���J�S��2�
=iNAq'�\�i`�#�����3)���j#z<<��N�!�@{�#P�g��v@
v:�YzEM�a��l��HL�x��n��	��D��tm�s�-�YNy!�v���6=
(i"R�C�0X]��km�-�S�����/Q;`5�~�� d�'b�Nb�:���j�Q��"��Va��S�y�O���pur6��m��PF�	��
2YXv�>�]��*��M�U��k���A�I���j4����"�tN{G����R=����b�A�z����Ng����6��{V���u�7��
l�3����3�m�3�8�xt��}Y�Q���:��$".7�'F�/VW���Z=��.8�=M�l�a�����Xl���J������	��m&����m���&6w|7(W��kb��y6haB����S&;�hy<f�h��\���P���O�e�T����r&��_5	El�n���;����d���F�(����!vS��� 
��X����&���
t7S�F�k��"�'�&�6�r���##H/Doa0C�u��I&��D�L��3
��d��
��#��k2)MM���JX/`�O�T!����!��T�T�NE��$���)�6J_!+(m6�s����u�W�1��L'{
5:�u%V"��*��>��^�r���u�drCJ�e�����RT
����Q�������9s4����n��'{�� �����$�Q3X)9���Yv
��cf�����8f2�M�T�Z8����`��*>�J�����t���71�,M��uH��@O$�X���Ho��#nh2���.S����`�-�����=]�!�p�3��������Z�����&�g&	�/y��L
���0���������G�x�����BA��^+��q8G���X����wC{%�h��m 
G��Ww���\~L�2K��z��,��BN��c}��>�������sOg$[�y��k���]��k ('#�#� 
��I���v3W�^��-9�s���io�m���g�����B��5����sbC��!{�%Y������K�u:�,�s.�:%��F@��m����(���0�P���F{��E��ca�

6��?r���O1��|����
�6d�|7���A�!�����zxLD?{E�vA1��1����"E�h���MU>�8�Ev���	7qH�!8�ot�-%�"�@�w!�IE�p���L��5��*����x�T^�[Z�m�����0��st����5f�������3��I�)��l�`�������V� �RA�����nAA��^mA\��%�����l]2������Z`���>�2�����A��#�~���`�	��79
����m��k��z�2����9dU��I����g����r�1�t���#�?^�49�B�:*�JcQ���)'
TMo���xS:W�l������\����0B5m*�����)#�eEI�"������D#�e�R��������������r#
�� �~���>66J�og�z!B�o�|9������!|�<�����F�dBwH���w��vRvwK�*���?���J{�o��<��<���p���HN��v��x������\������v���B��l�0?U7e��y�xeK!����NN�z�
RcK��^�H��<���}��GV���v��kf�|��4�����Dt�'��DR�t#�<�����xkGN�J�Iy^�.��s�Bj�BBrwBD��A��<h�&*�D������n� |E��2*�|���`�ZYJmk��q�	�a�K?P��
��:�V5u4f"���.�(,����\��T�8���������[���-\����>��������Y��46c|J7xZL7���m��WD[�R>5�jC��](�ePY��N�TY������oisI��>�k<�,��>�t�����M\�T9�y5 "8��%��%yM�H��`�;��S	��c~�� t���s���F�a�������i������g��z�^Hd�jq��������m���W�����c���w�#^t_���^�����z4�*���8U�UP��.����K����O����l���^
�3�dL#��4��E��?��5��3L@%����,wz��Y��]�j��DHv��(7�r����'1��Ce����[���{<�rS����0D<+����R�qU�'��@�W�4h����y\u�����bxI\~��}����C3���D����?�O%�<������n��=j3��q�bpC�jf C��O��1���fF9���L2�����,��}��[��v�e���n���\�=���1I����D!��������#k*�B�'n������YT�_��3�'�;��a��n�j������Qub��J��G�(f�<��.M�
��A�sz�/��k��8�?�Xr�u���8e'�e���[O�^�=�e[<�7��o:�xy�T��������&;���d
�5�N�8���s,G�!����.����P������V$�������L�k�����K�������x�]$�i�M��8�F����hxN��F������96p@>Inn�������Z2!��TU���50�N����k��kO��Q��T�?�����$����> �"�v��W9@\�?l)mD�=�<khD��������8RwQ#t�G�U �k��1^�_�X���u�j9�l�2S�~�� ����>6�>���������~;�#���(H����N�������	�!�]���*�����Uk�&�&J��q7��'-�>��.�4�%?������3�!�����t"���NbVF��Wb$~���4�������A�`=������,AN4�g)
�~�?@ZO���L��P�	��:3+Q�����b����m�-+�he%���X�����i',�:aN��A����]2MN�������G�������v��
z�R�3���}���_�6��'��_��
@�	�@�����9�[d��{�'bA���]VEC�Y����{n�n���c��������/�$V�3�`��V����-��(]�\�y9��v�k�(�Mtb�H�D��VT�vi���Ck�F��'�|M���=�=�a1�*�$�$�-d[	�3������=�[m��a��������K=�M-�C��B�t����q���N��3��E�����K�3F���>�_���p���&R��|b�{��f6�
�19 G����t:���m���[�hL�?�-�Xa��w���p0�ub�w��a|��3�#v��|Sy����S���:���p���7��!����m��U��Yj�:tk3c��mB3�<�`�cb�L���T[s���,�����M?z��E���N71���hq2@@���6���2{`/#�63qY\�?��s�?�����w��`z��q�'�5���7��O��5��[V��!�*Y�Nt	�c�@6�U�f!(����2�2�>5�>R.g�r�%�0�4R�~��s�(�����<�cS�=H�7w���K��@�{��;��w�G�{h	c��kvEE��xx���4V`Z�i�����1��I-��AJqpB�o�W����|a
B�F�Y���W��g��H���S��^��&Ks�f���������v���<�`�P�v��ehl���~���w�:�nH��k$C�&����/�!oLOd@������zN'�D����'9]�NG�E���Wgy�]6�s��Dg�����v���v(y�8�q��D��5M_a�t<(���W@q��K$v�C�S��������&��o�^���%Y��R<>�W�����05������:��6i`�!���������s�b�Q�0���de�����K�����,?�$����j��E�f+rfL��J2I���j1i��rI)�;4���%9B9��^FK:g��?�8_�D/��!������I���b��z��'��e����vN��5�����HeJ��������PbtLl%}���K���P���}���
�dy�;���|�����T�l�}�� ���YK
zh�n����q��b|Q�n�����O����WS&�@8�Of	
f�2o�TE�L���5���H;>}{||t�����9x�������p�A�k0:�,J��%R��=O�$��'���5��Y�.*��a����@�[i!�P���	k���wo�rO�kF����z�����������;2��
eUm�J��L$�&�x�'x)��8n�����	
�g���`b�(�aZ�I*�sw����gh���d��	d�D�w��n�o�P�n�HL}cP�\���X��=���-"oX��u�>�������,�`��(�����75�l�������6i�X����������5jM.�b�x����:8w;%��zKg����;�!�^��fU0�P��A12t���������gb,��1�_FoZ�"�Z��}X��]����f��G�i�j�H���������K�[
^��	-�A�.��u_�A��:��5�n��� q��K�7q�bt9��Z��_�����fKVZqV'���mC������r���+c8rDFxL�Az)��^|�bl�a����,z6�-�������zg�;�� :�o'=���n�M�����[8�
8���i����ErP|�=q4��L5m��v@����	���A��0���->)���T��M~K6u|=����ASl��V��=�j�R�����"�48?��E�,_GY��W�o��uo�n����������s����t�n����x��]�&]�R{i9�!�>m]��<�Y�50���$���
q�R2Z`���D��������l`����iZ����<��X����Q��3�����X�NR�DR$
ZhC�~S
~�4����j����>������������1l�C��0U�E��%5)q�_;�T����"q�Z�\M�
�e-�9�F���i��+s���s�e���x�=�������-��o�;�4��%����KI������q��hZ�.%�>80e���L�N��Z:uI����mo/
Kd�u������&xon?n����L�)��@0^Q��.G��\���3f�����E�2`Ho��CvVi���n?����C��W����X`�a�*�7�N��h����j?���R?P�'����F~�[��Q+���U���e��b��h'��<m�5������������qt��m�Q��T� �OFy���Cx��P�����!|��M���%���TSOH%���J,�����r�����~��q
d��^�th���b���~�O�y�1����f$��
f|�%����'`�=���w����2�&L����4�=�D [��r���X�X���N���H|oCCA�u�`�ce
�c������T�\�=S�{��M�L��?��5j�k���h��-�>��6&���uIt���	/��:�v���OQV�X	9��10���}L�x�8����xH���)��������L���^���5�����:7>}I� ��eS���W����K���J(�/�����ho!��t	���t�E��'A�����~{J�>m���w��y�#���w��������60��40H�
6���C��>�IVG�������j5rD����5�FEL�3IB]�Z/����=�+6��x���HNJ���G�o�K..L�])�w�	9�#���7F]�=vu81((���J/7���u�<�x6�%��Ei����ekHW&@I���M�A^\q���!�3�b�M��/O�D�R&	?�L)��^|u�Z�N��9��.�X���7���o)D����n��
X�b�����K����-)�w
b
,��<c(������
\A
?�,�l%s��dGw�cs��eC�1@sL�@�V��s����@���yF��zH�@G���E�W���K	�el$�������M$�����-D���������X��q�Ql��6�r�qE�f���{�b����<��K_gD�u�E��������~b:2{��a�J��/�*Mu��-0=����Q<X��N�hKJ:��o��FHA@i�z���+�����Y�p��uU�1��,�34������8��v��4JH;���,<���-p�O'
"����p��\h�W��\����KB�]d�,h����(��*f�����VQ#mOK����	�H�����B����\�[m����t���5j����{p�� y'��=NM�MW$��2"������x��'�����(G�XNy��y��
Hu�/p�.���|y���c���&�=��z��(�����V?��N����/��\�#FfN�"maL��C�����st)0����e�9�.zj���*������WIc��7�)x���m���5�eK�����t����'�@<#�]�]��P�e�-#�����d��^7��L`������N�����_t�e":57������2�1�5��,�������
U������[����-�a���l���FG ����������24�k"���M��#�� ��Z�(�����8�zabelG\���jwD��h�h��N'�������3���l�;�{1E?����.�|N&��E�lJ4����&)${�h�����8�$�������L�a��vGi���h�s���)GXO	o+?�������A���,9��������@By�3N>����T�Fg�.�� ������������$�Qd�+vzds}�S��N����u���Q*q�0�����N����f7�O*$�R���1+��f,���d.���D���U�`B=�Z���Z���+%d��f�8C���Wk���1��yd��})��u�k�8O:,�K�����B,�x��l���	^[��xA[K��o�BK���d���(S�-�k�s-��Li����W���h(EK�^����;���I��
]��MLGf
q�����b�x���0&-7�s@���O�����}y��d`5`"�5)<A�H<�9���C:������
:w�7:��1=2�No������q2x�O���0�"~U��om����
���5?��%L��?wQ���� F��i�@I>[y�5�S��"��3�������Q�K�B�������%��>{��e:�=�������=q��@�tI�A�Z����`KA�74�1�����#�����R�p����A�A�a���Ev$c)F6TQ�b�����5��s�0��o�F���D*�f��pA���H�,Ya��J(�]����\��
E���GX������6G\$'7b�]b%he"���b�0.����a�� N����D�E�����~��
��FJ�i�$n�A��jux�����S�@�zv��X`�g����'�b%*��,��^������`Ir�\�uh���*v���)emK���9��������U�������$������>B���M��}�')��`!H�o�_~��_��BX����`6qBn����r��-�V%+ �/�h�HC�di�����q�9�� ���2�����Sb2br%C��6�lr4�]���$��GC/�]��t_�Z�����>�����!������lT,���3-�
)b7����5��`Ly`&���i3�2]�W�M�Q(������f,�l��
�������r����`��8��U|�N�"�)�N$J�m�p4i�D:_��o��e5�5hpn�i�"k�^��1Z���L:&����8�P��n�\FGe8�(��P+���dmn�p�H	h�o�G3��8�@n"����;�T
�������Rm�Q.��8fZZ?o9���!��Y�\��a��c������������p��&�y8��l�s?b��(N��h�����Tu��(E��E�3��	^�Q���k2g�������f���
��/	O�-
�
���Fy*����������!�>����]?�tP:��ew@O%�:����A���ap���;M��m�Z��$�[���]�ck���b5��h"�)VI��	w����p��n5yP
�cHq%a����~���N���]0�)z�k�T-pY�� �Sz��%��C�=�eud�����j���@`���(�R'$N�S<��x�Y�,�~�l�::i�������o���(�R�e�����j�_��_}3GJ�R���@������0��,
R������Z�{JP�Q���s��Z��~D4z5�b9���NRPs���3�Fw����VMu�aP6�l4�)$����x���.�Y��#���J<�d#�N�7�L�����8��?H$y	�_�wt`�!��P�"U �^�U�O���4!�e��_�]9L�H�f�#���b�#Nw��e���U),�>=P�����W��U�'C�^��u�C�K-����@h/]�O�r���.���5�;�.��F�2��� �Z6�@$3��p�e�L��~�W���n�L�L��vw�~��3-��_GG�mC�����<�>�4�E�7�����t��S$M
C �*?���H�++@f?��Nf%�� �R�B��qf`��HA�k��3�.r;h��mQ�7�\K�$�'J�A���E���rW-)�;���}�1KE(�%+(]�g�Y�E�
��j>L$lk6� E����Y�"�]�p���Uh��~��v�/�N9I	��MoR���K�����h=��g9m4p�X��WK7^#wd������>�����m"s��y�3%�;s~����e����>I���=���Yf�R��������_v�����nZ&�0�rkA ��^<�%���%��=ml4GZt�y�k�������w	�N�i#�'j����6w�"q����B�#����=/�K�st�tB����s�Q���J�<����ST���;"?F{��������/�p���pL�+WS���)|5+A��}����&����������i��4�Ux���Y|��X��^?��ZxV�H!�OD6����@'��S��&�4#	x�������R@����0���Q�rJ���y�����������9}6���d�^�����?����}|�����QA-��,6@�@`�
L*i|W����+��47���k�[�sWl��}��&0�H����o�v�rnh�1,+�_]KpHk�]�*�l�t���I���a����^B[� 1���c�$�R�9R�H�N$����x�M#p�J+!�R���{+��&�C������3V�$H�\���*��o�T�*���A��9I;�~9�>���\�!1[��P!n:������;J����>B��V��+�8Y ���2S���~�$�'��|����(���)l�7i�]��sA��QAuW�Y�e�,�B�]H���^��d��4�>����b%���qq�vr"L�����/��K�&��Q������I3W�C��XB��R�d�hO��������yK��'��Y_�Mk�
��o�V[��n�_�_�J�T�.�Wj�*9������!V5�Vb�����Nt������M�H�%�(���
^�Z~�/�������	O{�M�x,�����Q�L2�@���q�9cP�k\?E�s���/>>��D�|._�)_�`o����U��>��*)��s��q
���U(f�B����c`���PH��#V�����
���O�
Ej:Su�L��T��P|�B��U(��C|����D�b�ve�T�����������M]~�����#��
[�`�3K�M�n���H����������W�Fec{�T����r�N���b�:��]J�
�kN����,��I��S	���A�/&S�l������s���kxmE6=Y'�N7i��:dI��0&OZ��XG�E9�X���J���x�x��K;G�[�P%�C������0�~V�N����p>��MR,�j���MeT��O�;�[��"��P��&����0�4(��A��3@9��������V'�$�F�q�\���(EO%�� R:�,����B��-b��8:����g�}p	qZ���3�v{�>�>��zk���z�'��2��p	i�bd}q���AG>��76-��b�bP�w(��~G�pX���w@�K���B{���	��h��.��~t8�P���Pv�
C��^��^�c��e��3�J��I���J
J����b��+�k���c�@!��o���}tA�K������&Y�IB����?��J� wXAJ6�S��$�!;�T"\\��M������n���&V�r�.-g���/�,"����wG�
d��wK�5�3��R�!����u��Y������J��G�����GO��v��k�-�z��)\]F;>EA�'��	�'�����0m��{"0s�
����4H7"�)��i��S��:i�o8�\D=7����%g%k�X	�.B.9+��"�%geVg
���q�'Q'w�>.2��>.+D���e!?oa8�77* Lom��r��O�~��:���P=X����l
8�Q��?��&���"8fc��Sa�Ht���gX���,�w�U+c�FR��1�e�����t�M�����J���}���y�JL��y���a�=��1��z�~�����4m:o!�dG��<e���)K2�;�/���|�n���n<�&�������lO��y��(y�����t"��Y�W"v���x�OV�9/7��	_2�gq``LrZI����S��r2����;�K#sL��?}Y�HY�eIN@H.����2d�$3��Ea��q��$P@����v�����)6��6is�����=�������a^�����-]�t�����G����
� �������m����2���w)RX{�CX>N����bwIL�I��2�LW������kW���9�[X���,�Y�)������5��)�@+�lmT,R~`������>��P�:��5C��[�v������@��k�3&��J���.:����{��`~8�r��]����{z5���������W.��W.�M�\�U�|P�����&���u�'>��0'0���0��L�6Y�]D��H*�E��nc���������O}��Q�R�/W���M�����P�����T�jmo�*��gr��p���S)P��
L0�4Y��u�J��G��3~�Cv7�����3�������/(��*p4T�F������[Rm�50�n�����dmI:VYm k&��������1��F���N�:dTrlHJ[I�G�$�������?����(������F$�������d���G������]�cE�_E�i�*���u.�SB �\'�s�x��7�q�0���a���j�~n�'F�R6�>�s����� c/W@�)���u�@���O��fRDM��,v��6�S���'��W�\QPM����>q�����&�Tz��o�nS?<��4���E�lx�t"��t���,���p5b�=����Z�,L�bj�d���0S��
�����O�Fqw��j������)�`��������v=Lv�3T�{������~#���p�6�|����	M*k�mK�mK�yW���N�R��T���z�����7�enV?�2��RF�UYWW�Q�:�G���x�8�7��t��5&�i�o]�Ir���k>���l'��d�"���x�.�����/���=�&���o�?�Br6���
�WP��Yv��(GS|����w�*<���ic�Q?m��O������������W��E2���eE����s���h��K|��L�y�g.�=���ez��2{ 8�������m���{sN�h��Yg��zvz�l�s���������f�B&a���A�ir}����"L�6M*[�w��)!������`���xb$5�Fjc���3I�I��(��k�4
�h�t	�������ySD��)���l�Q��������&&hD�k4�����/�a
�~� �[
a!Gy#�N���n
�@v�������(-F�Y����X+��y��P�y=�+*2_�����B��Z��:G�����oz��=� ��k��Jus����i��,kvI��,x�d�K��L���fazW�p������Z������a�L�\k���f�k_]�g�h�����2NxM�d�|����"s���]��z�z���
��'�����]MY���i��i���x�d�M
��&��������Q��-��M�['�JeB�.��}���o� e��F��a���m{�S9lY��^p����f�[�N�]3�~�0�%naK\&O��,qa�[���s<P���.	w�,q�2h;�sh.��p���xg��rf2�qk�|�~`������u_`���X'�������\�3W
p%E�
���`��n�����������l������]�������EO(XcJ6#��H/<4Q ��Y��5i�) <v����D�~�*c����F����ow]�T��P��?8������o9�&'�s�5B��5^B�R07��&�3������m����~p:��	�$�9��P��|{�}������+/w(�����Sr��\+V��Z1;��]+�iS�w[>�X��|,�����Y��6D�����`�`�|��S�3s������#'d��T3�s|���t�M9n�4y���P�|1����;.T����#�c�F1������01�A|p���~X�A�+ �*��
��!H��l%����C�u���9Bi~j�DRL������|�6���mNr��(��*�
������{���;�X.M�@�`5L����6��B�
����i[�O�F,.U��r98�3v�h�/;9��^Ajr��!/#r'�B�B�J��fg*�,�p[��S�����������g�o�[�4�N{>k�8kU�Ga,Fs���]	��k��];���Lz�&�N��oN������'�=F�{������Z�lL:[p$�+��}��0�H�qA 9!ma����oa�fpv�rT�
����~�@���5�\����	���(t����U(?����?���Um�����O��4jr-T-�P����>A�Q�������������Re���+H��r<�O���l�]����Ue�R���u�����7�0d���G ��*=8�������06��i�Yg�V�utr�%�Z���r=*wd���#��u�R�+3�Bw&��l�3��D��g���n�}��8��,�)B������|��O2;����mU�a3��3��x���
sNLE�].{���*�� �:*����HV.��P |��p���f����F�����s�#�������N^�n�6q�#��'@;E�W����t��|:9�G�q�����CM%�����{$�� �ue%����(a�O��MK��
��|�lS��3�dj�����eL�c@�o�>���i�J3���5"GHQ+�����?)�~	)����5��@x�86Yd��K�������5&��U���^
�ZS!�2������m���o�n�W���Q���T`\3�@u�#!];e ];���m4�b!}��W{�$G��y����Q�^�����%E�6�j(�<�sx���.����A����|��n�egQ
�	8��T;�*����� ���i�Z��-����INM���+7H�<?7OD�Z=*
hP���nD4#��jS�*�~���UwH�Z�x���j�SK�Q�(�(&+�Upt�g����x�����o�WL5��V�j��Ye�����1{X�{��D�������x�)0q�W�g���&�b�:M8'�U�f-����>}��E��=�azX������G�d�t��W���3oO�~==������������N�l�ml��|�����V���C��>�'=)'�B�������SM�g�@�O��"J�������N�o7K%o{~�<$v��G�S�Jmd��u����J�rH�I�����3�M�z���rF"&KF�i>
A9MSs��t��F���P�)&��z����W0n�%�>�E�����h?:�G7q����+sZ���(���l�'��T�L�~��4��mvM����tH��0d�W�g�
�C/f���ON�g���'G^-��Z��]zg����5���2A�De��L4�;�}~���q_8��h�~APDn;���DV_I����ODB�Q\G'j���8��X6���|LU��"�+����b�J0�p���'W������2��m��k<;A��Y��
o��C��J����l���Ms!��TaOK�}Le|�J�b%����C����@���"�J/d���\sq���2\��+�����I�f	.�=H��R���k�bm���O��=q��m%�IT�SZ�=g����#<��6j�HQ�[3�h�a#['2h�����/(����O������,���G�B�O����5cQ�t��
n)%�Rr�A�% ��-<	������v�
����
�(���8i��k'��K:�P��a|��0N�L�4�_�.e�����!a��.�S��qL
0�W������2��C�L^�rN��e������Eg<�ba�3�Q'(�..�1:;'�.&�^]M�������~���K�E����o��4�����6�g@�F���m��b�y}{r���~�m��M�������?5�����/�T��p���m
���[}]�9aK=�7�����^��a�s������c�e�H��\n�Xcnd7���\�v��a��+���:1�~ y���s`�q'pXc��Mj�T�(�Bth�����*BG�n�;Z�;<Hx�r�$���}������������h+W��!B���=����
W�j��v��ODP2�D��1�{�����=6U��ao�&<
��Mfx��/���q�B�����p<3C�c?[���N���1n�������e�8*�\����� �+���e�wI��D����q�fK��
�����3�>�w�!�����V^��_GM��x��;U���%��,�
n�������
U0={(@�@U�<�
��^�x$��7��s�t��F��E�T%�	"x���P�-VJ+b��$N������Q#&�@���	���W���,RG�0����<������\F�.��w��@3�n�m	QDi����r�1b��L��8p�
�0o������bf���6g�Q_$w���j&p�F��b��t@��Y��gL���2�W��ju��|�Q�b�g��4�l�����9�b��2�E��y,�4�c��-�;;[����v| �S�
O�t�Sp�}�S>	�F�]�3��{��	���{�Z�\V��@��w���c.W���I�2�E	�zT7+����;
�AO'BH�]e���������V9bu�������#��Zx���	��	z�pf���������H��hf�j:"�s`�8���,JHc�9�|P;���l��������&�y$��d�r���I�u<��#����!
��(������(���qR����	�W��
����t���?b�T��bT�d% ^�7�lYt[p:�A��\y�?��e"��,Lt�����@�j���op�M���?�i�gL�3^�mP��o-���xbWp����E��&�*�s�;�k\�;�2�%7d����)*j�0�����u��Uj	���)�{�����G���:=&�~d���< Y`���|����(8��rV�
i�}������IP�i6����A��h���������0�����s
xZ��[wtZ,�4��R���c��7�/_��W��iZF�k�g�5�����D9^���V��~��t#��g�,=��D�������y��0�oZ@�0Rc���&�����"��'��:���n$�,��m����,�8	IgF��K��.<	��JPc���!|#�E�h�^����Y��f���]��_����
0�����K
����iu�S���!������Mb���*�oyz�!g��f�_�����O��N�����������������NT����� �K�|G	]ht*)�m1���1(���S�����6K��(dJu�����-x���j`��H���G���@q��@�
��w)��x5+M�3��G�����k��5K�	�!�@n+���|Q�=L*)�x�:j{i�g
r��
rK������NN5�Y(<X��An��4K�������� ���
r�{[��%�����h&2":b���M�
����R��v�G�RmG��vY��h�,���SX���������{��X�0�/a�B�@�h�2m��"~u_�)\��/�x�����U�7}��MsUwJ'�^��]�d��G���g�����9����1�)n����y�[<x�����W��Y�Z�Am�����������p}�I�`h��QP`%G�Pt��D�Wh����8����
�������,�e��
P��_���I�PW��E��$E	)�N�����k�Ji}���#=����1�����.|��~��~��~��~��~���g��g��������/(_������p��B�U7��~�����<V�l����r��b�U�����Vp `����| e{����I��9�+�������d�������|k�����0�N1z���qQf�f���r~^,2��_�^z��-ul����a6�sb��a|�i(���F�yD���z��2/�'zj�C��:�{S
y�u��g���3/-�"���oP�/��0P�^��N���>f����`���&�Kn,Q-K���*68��2����kJ�l��hv�E�-��6A��r.[�t��j���3G���\�H��U�3�D�Q���\
:�
VdoO)�%xcG'���'�h��\�0/k_�{����#�t�~�\:K�Y��\2�B$�����;�ao�����U7�O�zP�<���1hv��e}3�E�F$�\�:��r468��F�@_>��"�, ����c7�14�SP�����
�����8z����R:Ms���J^�As���$������d�fF�-�
��%w8zT]���_��l�	���������&�'ja	�b8�/�?^���t��-���I9����!�l'��^���@%&	�����\%��ez�+��5�s8���/]�����,���,�g"G-��V������&��]��-{	�F-�m��jDcc�d
�U�����p���Z)H0�&�2+�Uw�(��Q�&����P����������rK�a;6�����y�+$e���p�+�t��\Je�@q�eu�p���m��[_��>7:/:����[<����Z\�?����_v���R��-,�h���Sb,�3�M�D����Ia���9o�N�����s����:�V:�3��P�
#�F2�wya$D^17@\O<��j������6��{t�otE�s/�fo�ny�H�;�Bm��HC����^cL!
�(#\=J�x����y� "}�_'�k$���4]"[1�Z�DfY�CMM�7vd����$T���x!5�������:�����'���0��?VN�Dx�br��~s?���	L$i��d�I)C���iUH�t�
PsDwezk���{]e��Z�<=#��� �OtGN�:�M3��&Y��[�=�T�#��=�eN�&x�|@j@�F��#5$�����{�Q����$Kz���ua����e����e�z�Ap�m����L�0n�`G7a�����?�YO�PA�(��!�B�3��p�Y>�6��LF5���� 	����D�NE��/;�l@o	z�v��fx��.r��dgX{��i^������o=��v3-��d&�{�#���'�a�`Eup#�l�N�S��@��1W9��(�F���n�5���@��(�
M�A���>kI@��U�H��5B���;��E��cl+��\�!>�*���-�'�(h%���RY��)�Pg;������������V���7���b�t'�D4'���q
�p����K'?�"�i�H+:��
S?������X�$��5,�����;�����\
:\�����]�%6��9�&_�-9���\�(���VJV� ������N��R��F����5�o���"����|�N���P������#�Xzm
D�d�L�$[���S��#������L|y���II=�

�LfI��5�����w�ir��
 ��W�h-������vQ��FL����K��I�c�B7���o���xRe�\����c��k����I�m
cD:5��S�EUl�<m�JY�}���E��P -��p��Gy��<��V�����������G���u��!�&C���Vv�t3�1��W��-�p7�F	7bU�������{�PI|���o@Z��K�0*�_�:�E���I�mg��5�]CJK��X���-��
�	��{�LbC�1�JY�G�8n�~����S�H�|�����	��z����+v�b*RVs�.����[m�q���,"(��xpMh�$��\`o����Imo������������2y�(
V�1��zZ�tvs ��[�)�e��2��lU�1�6�(�i )���{�s0j~����k�B"��	�3?k�x��d<�	4�%������S��H>�W�hQ__�.���&?��K�^e�-���0�6h�m&2�`��Eu�!�pX���������&�.���4�
b$���ob����h@��/���t[(���9�x		�����#�("C�d@��s�?f���?�4T
�}���I�`�/=�������f��u�PO��E)��\6-���K���641��A�:����7n��;}�<<�s������j����T�@�3�,�Rv����u����m:�����;h-��E��~�.�C3{�)T�E���J��=M?���9���7�;5�8�i3���Wf�g:�����������o�Fv���PK��-�o�}k����*��a���BI/��$i�8Bm4���G���|�I�B!F��*Y������g�J8�����HB�4m$�'Oz0�_zP���L��|@�1�"8i�>���m�td~�_�)�.�����������3d���nb2i�S��*�t[H��K9?�d
�>-U��f�����d�KE�h ��m��}���'�	_U��U�5�>6�����W��Hm����p�}��{���S�]g�����!!�v�#��x���*�Ln�H��F�	e��n�1�i��J5%��E�;�S9�5IL�L�/ap}[��~8��
��VQ�6��xJ���k���W��&`��T���!V��P��e*��v�M�*�?����ED�\���=:��S��(�Y��	�>u|=s��=�.���{�%��]Kzr�J����]���	g2�&��`���%��cD�bMe��N���L��0�����i���u��C�4�bc��	��Z���v�/s��;1�vz�����&�c�l����B���	:6b*�6r����
��.x�)"^����W.r6*v�nu���������'���3/�-n�k�.����3���I����z���#|�
t��ft�}&�����2���<�����oQ��p����q����j��&�z�;���ps��R�5�B�a�3�=@&�^Y(���d(�lFV����AG���'H�	}�r�#�X��=�6{�*�S���U<�tX4�Y �#2�: )!�G�\i���t;���Vot���_�����V���Ro����>���uz>.�����;6���9�p��vQs>y�y�7��Gt��Q�w�&u��O�	��=�V��Z����������j�jxk�J����}��R>v)arZ}����s�=<��}���uvBM�5.H�tLT�:�J���z	c�L"?�:����O��}N���v�T�$�����g0G���s��������y<��oA���U��3Qnj�y����z��HMH�4�M�����b�IhQ����_�K���
�����8��C��v���8��,�c���m�V#C�����;d�w��Y������Xnu���Rw>^C���b�f��l7I�_w2R])zB����Qo�KQJ�e��<��^�+��]�>7xK#;Dj��@������E�t0>R&e��V��a��_�x���������a������\q��8|�&M2�g�
?��G��&W"���-�s8�l�ax�/@:���ng�"ir�E��!�w0�yx5)�!p�
!i;�n�,*�_3�9��'z�^�s*`�^��	z�l��6��f���=%�������5���$��}�"��|3���(��Gy�T�^���S�Kxh|v���9][zh
�y��=�L�9���	Gs��aH�7x�����]i��Nl@�D+=^���N���m�����rG��*�"�[�����C�XAN��d�54J*X��U=�b e�������������)g�U;�s�L���v����oZ��_^�H��l_)��X����2�a��,����1IL����8Rf5_+���,���{���n��X���	��ZZ�PZ��#�����v�"�O����P����p]L���m�l������\"�[:�.��QdR�n�M�'�*&0����=�_��A�0�����	W'qb�.�$0��������%�O�z�_��YX���f����I�I�����zRC��U8������C�!���Z[��M��0��j���+�1Va�x��o��g��'�����Y4���DY0����a0�5�EZ�ZR��G��*��KQ��QA�QT1*K��>^O���=a�gwUB�8c���H��M�i*;�c�������)k�����7,a8��Yg�����2�F�e���	��)���JY��)Xr���tq������P�����VCrv�J]�x����IF
a]�y���B�:>���;�q7���������M������e�����@T��/��:�<'�q��&�BO��=j�Cgm�y��6��Dp��Y�~��C���T����}	R6^#��
�n����	�e�\�e���\�o�1~$YD���Y1�����k����6%�#zc@��V�"	�����
)w���W���H<^EK��a�ilX�����0�\��D��B��=�f�2�egS;Z.��y���J���x�$K���������$n`�����#�P��hS�PAm�#�6'9~�	k�?�oZHH���i�����d��]$qZ�~�<zU��M-��Oh%N�o�����t�au%M���p1��@<�^��3b/���P������b
x�f�tR) CCX��s�
���Q��C���  ���6������|���f@k�4��WAb=�5��N/�%4�E���(x�]�������6'�;����MsY%�������j��e�����5>����*���M��]�i��u�|a&������S&�5�i"�/�D<9�������l��D�(��U�s%~����2�l�����+�������)�@#�I���qD�Y�2�.-�	9W�	$����7'��6" o�����k���
�$N���Y[�K?���W<��F�+��TKX�I�d	9QxI��KM=��J��F ��53�-Jf��}e��K���k��a����!|����<��
�5��{|#�� 1v,03
�-��chz%���lt���6>��=�Gv.��kR��P�o\e���3j�6����*
����5pg��[��>�o�)MDp�e~���M�Am���.f��,���Sf����Rm}ps����'t��dsq���t��V��2�P1���U3�}vn�Z��c�%8k��Z0s���0iN�:�
*����P��M\�6��%���M��]%��:4NDe����P�0����24y6-6�Bw�-�������ML��a�Cg(��?������D�t1��DG���^.bX (�%;��T����v))�����}�^�=��E���g���@u�T��#���3�;D���-����iE,����w���/�a��|`Y}��6���M��68�U��8���c�� 
A���h���$�R���1��V���bd2����0i���
��w31�,N /�'�[��m�LS���8?s��a��O��P�������	q���4��"��w�%?��;����������V�z�
�D�&���_s�hw�����+���@����^X��k
2!��#�U����W�0��^��L������W�FW�^�_������s�X�YO���Y���kHJ�Bj��H��B����^��qx����%���,5}�:�#�x��<L��.~�3�����\���3��E!��}�G�|q#��J�!�cyg��t���Wy��������z���S��Q��e E�G{�
~�_�V�xZ��~�2�C2-K.��TP��5f��im��5xHPB�\�����&(�Q(�Lc�����ji��fK�=��|I#��YDx�vvJ�k�5�Q��$���D�S�g���tAV+�u�������0����O+�;�tn�Y-��jp��!���n/�k�s�pnRE_�0�}�y��F��B����I�j+>D�+^K����&�/�k�m���-�/�ah�d�����h�=���d��k_!���T�����2�u���R�XE�~�<>������~Zo�l��]6��^�������A�� �\�@����I�V�$<������a9������7K���m�b�����(�>���=Q��S$i%��c�M:��O%�+U����v���\�r�R��K~nT���W��@dV��@N��4��9���7�0W�_|}�?_���F��1�����U�|x6z������dt$�����������B�����L�����a7~�ilr@��������-ZiG+C�=R�A<��u��GQem�U������J��
�=Bsj��5���[�N�����]���2bb��`��g�k�N�d�ae�!��g�d�
�w�M��>K��R��@>�CajR�0<
e�K�n�dBv������+�����.��� �"k
o]�R�:8,���!�N�.�	�b0{,��#�[9���{^�f6u�C�iHfT����>�	��cGA�<#��dK�e����}��:&����T�r���]�`ot��>��Y��8P�]5Z!)�����z����rf��j���k;���,y�1oX�3�T�jfZ�Dus�'���^N��fz.���������zu����*t�&��.�#��M @��j�P _����q$]� eI!t@V{t�c�t���I�U����(��2�>D��_�3���Q��[y/��_r6�(4�*���%������'��Y���v�E�R,�2>���H����^4qo��i[�.C��q�����B����,������(S��r�1x�
�)0,�\���dvi4�����4��@�M�4f���g��F��*�;��m��W �L��kcz����/�V�$�z^�trm���k;���0��MB�r�QJ L)�>��>�6J9#sd���5����iL+m����YC���������S�-&�O�"��f�W�50z��*�"�����g�!���@i�J�|��f���Ji:|f�����{�����Ry���"�m����f�vsvW��twG��:TdS��M�@{n+A|D3=�|�����w�\U��Lw[�(B��[���+�r'��:8���������IB%�Ye'R?��p��9Cw���+�UrH�t��������Z5�0��������M�K����o��}����t�Q)�L�+~x�Nc���O��JZ�B<r�A�_�xx=�5Q���3R-�����'
c�>�������"�����x���T��Cx�
� 4�Z�j�����.�?��*�6�s���G���oQ�"�����*�t�����B�Y+�v����},T�Mr'�����B��V�)������'�C)���h<�"�l�K����V�y�Xx>��J�p�2� :ll����Me�S8��~�J���E���V^���Q_K�T�M{����Y��o+���zV^$jq���fk��cq�op��'Eq�%cS��&�N[��j�pN_GK���Lp�.y������<(���:��_Gw)�j�k�����+<���2F�����Dr���6d�
�`zq���M�k�G)0�� ��������Wa�8z�N;�&����*r
zH����p^0����k4���������'��������y����(�Q�z��n���p����/��q��x�������|��z�^�v@��,o*�}��8'(��}�i&�����M!)��J�a�p[�Xn$�;�F��b�F��*a��'�)� r[dY(0@����|��F�:��9{^WW6v�N���u�[`R�Yo�����t9��n/D&}�'�N�P�4YdA;N�M)2�-�P!l���T����U���������v���|t'��!���/��X��/�j�����7)���r�{��u�~P0��=������z�Rf��Jy}���L����Q����u��M#�G����HoH�&p�F��')c5f���H�Q��D"t�d�f���%�D�h�����
�c����%K�V0&t�C�����c��$�pn(���vC?7��)5C�:�l�^	�~�av��
8����e@�H�,���^��
b��P2-���;�h���[&I�r$�/�4h�K�!F���dc�N���^�*�����t�����u����D�0����`��L�n�W��I8Oh&X���*��'V2���Gr�2�E�4��9chv�m_�O�=�������g�0�����kN�e$*~!����pU�\�v�<{
�+}ES�(�\�w�[�e�%[g�����,*���7�te��N��@��A��#�u��6�����C����w\��|f��y
�����8�
<f�[�5J��D�����&���&,|�	�%4�P�z3���&�=��R���\�P�Tl{�"X����z�@NJp�����IW^����n���o1�����v7���*P)>�6Zn�:��#�6�A����fl3�N�`�J.�^�����
�(����O�����I����Y�s�ir��d4z 2i2�^���`jJ�G��V�����u��Qh,���=l��;�"_k�!�����(������\���6�xa���uV�Y��7�I�
������Q]o�������6z�8���U�g��`��R�P�EC%r����^V�����-���Gn�*�/d}�A���{�r@�E[
={
�0��� �k��Gg�0!�J���{�b�J{�W;�E�I�,�.
�Y�Y��@���rE�)2��h�T�#��E�����^����hKuI����'R�u5h�����j��]�iT�{uu��8��O�����#�
Bh�RG���������}����t�� [;QWK\�tg�M2n��7��n�1�x��"[�C�+��L���k��xt8�\A�]�����Xk��^�������\�hZ",^�>�4w�B��i��u\G1��~���t�i8���Pc�e>��������vV���
�n���j��'�`,��*��]�������sV
�@����l���
��7�����.�����8�
<�?h ��B��5�� m#�32<"C��d���]�mc,(�������(���n�bW�P���f��v�Bj{�3���fA���$V|c~oHQ���(NO���Nf�A4����0���v_8A��q��l����(�'`l����ps�>��='i>�=XAXll�?��Q
��a;�_���KA �
2.�>��7{VR0�:D��0���$?F�V�XG������&�*��a�_S"�Nz�������|S?}����.�)M��������^���rf����\���V����0�����(��:�Z��%a�t|�����m��j{�������#@����J�l4��!�T����/���9�]\�q����=��
/sN�D-<�s��8���Tj�G.
�2%���2�(��7��B��X�����s�q�v���W��k������-��������'z�S������W7U���*���.�m:�b}wm]".�����z��[�7v�����I��k�Q�$��O/I�9T}t5��XO�` z�Q���)5��X���%?�&DM�\Sm��yZ�D��[��������K^uLt����zD�����%������5�1��;i�=�u��4��-q��g��9S)O���z�p���7�y���Ru���0�L��Q��y�8���Go���������5�����p�\t��i�@h��j���_��^~��O~����F�M�����#ul�,\ ���.�����}Lua:5|U��[T�O�o�����1�w��p�9y{
�)"�|,�y{X;�?��_�=���������������������S�Lh���c��������� �*��K���������T�a��[�����2�K�~b{���Wp��4��b���|�DNO��I�����G���f�L��]��w���������c�Qu�S�I�c�6��?�f�7�9W�$��c&h~}�~ZkD�W{o_7��
/�������lDGo�@I�w�E��\�,B�l,���343��G0�Z��L�#>������H0C�|��~b�O	b�K}U����xx�����/U���G������U������f����o]�W(�������?<��<�qd�*��������[�?��������~�	��]�C�CC������%�y���h"��g�+�G���lP��� �������K�F{�!p��O��T}_o|�Z�Q��4�	n��
B��P�,M]sP�`D�&��Y0�3���M��`��������TW^v��G�x�Y?��yx4Pw��h���+������� ����x0YM��5��'��_Q1X~<��o��G�����Z%�@��U*W6�]��e�';������v1��c�ac
r��@�|���e������
�����JB6����=FK���C����G��������3��&���Tu�gqP��b����d�QL+�4��>���E���$ $��$���
#w��M�87z����;�;�����������a�D�2hr���x�����
D�X-r�7�Y�~`�I�3m���8V�{��E���-6���&�x�^s��3E_�D�w�O��n��r���4T����!��.d�/8��Z�����_�O���0^bJy��y#�,��k�������{4����!�c)����v�SrH�c���k����c�S�xF��M;�Z�Q��<������?���c���j\�����nm���@��G7�x��������$w_^o��PP���rV6�H��2��+[�h[g{�u�����&-�Uu�l#�/4�JO�Gf\rB���$sv�E��+�Q���X��1����j�!cQ^[������J�oV����/�Tc���8��N���h���?�~G7�	����������$��L+79uy��%���#���aGI����r��Uv��v��6=5v��,�z�T��ee����^��1Y][+U�6V�����E�^�XbD��$�wb�;>�*��T&��c��3���y�����[42��{�&=&�R/��:v@�Q{p�|<���n?|��4�8�v�8�v�V��%��	^��q�R��Yb�ZZ��*���o��@��������f�r�{y�M���U��~��)��py
x��^�s�gvNM��5A=�r�t�a���`o�_���F7\�v~����z��2��<�.����7�s]���T�.yt�X,��PC��U�>��)u�z�qC����:q���p9
��9
E�:�����nur���fr�N* ,�����1��k�������B����i�A�Yz"��wg[\��Y���}�B:��bZ�f���t�������Ni�RUpk����ZP������x����f�����8a���Mi��1��%x?�{v�6w,�n'e e���Q����
7�wkhc��qf��t��P�����d�M\T����xH�a0��X��������a�[���]�F����t�0v*��h2eY��&Iyq�!\�pouR<]&/�x���)h+�Kp4�'��'I� �����Z�Q���/����H[���"c������t7����&sk�������[�((����<����Z��/��P
G8�)�8l7���Mn��������n:LC0
^�����g=������XE��+o�2���0�NCKpMn��M�9����,$�������9�z���AEN�}��
�������:`���v.R��\oJ�3��������<$�%8;�0��F*��}���|>����yhSn<$�J
��y���
,�@����G���>����1�4�nG��C����m�j��A��)��ML���T�����Q��Mq���������W�����a�y|R�w�u�����	p��gz.���8���~�=,�"5�]r�� �?b�3�KR�G}�Bbqz]�t	�����.*�:��e���?���Dovvf�=p�����^9=�i��|&}Nn0�N���s���2Q��1�x|��3�?���i�RWuD���Z����
��Vy��D�������I�lv�IK�e���<ouF���^L�}*�����M�[��c+�KJ�i��������[��n�8�?��6��{��)�muwms��=5[B9U����E�M$;�;�&�����2R<��[l�_��AW��N����.�z����b���`����Fp/�s����.��OJ-����l�_��a-4c��"�
<��mU�����y)�.n]7��pF��h|]���=���]RY������[��-k6���p��z�������C Q�e.������0[��M���VtF,����QH��N���q�}�z�q�����S��my-�d�����w����1����>��h
SY�]��Da�vJe]��l�2��������N�U��� ������`fA��_�6qY���*���I]/ �>E�i�t��T��bX�?�`�aL	i��Lk��oNl�����`���?:��j��?6�C~<e1�����<�\4��xh�Y�dy�����4����������M�47����VV�JU����z�z0��$����gt��Iy��az��F���S(�o<����jbJ�#'�\��I^L�d����g�����X�z����nM�4O�����Uh�F���tnS�F�Vz�9�1�*;P|@�F�����|j�,q!���������T��5�g�E�S��y
qZa��$�n��c�,�w����e�����y���������l�E��d��b"G�/�TD��$9�u��g�tM�$�6e��{�93��i{0x�3M�h2A���V���[%����&���t�?��:�'C�2��g�;>c���Z2D/�m�'WO����l����Re]�>�u;td��XT�a'��0>w{��Q���:(�2�&��!�pH���$�l"	 NT?�_jZ�����[����wC���3��Qw���z���4xy��:���G�#�V���9T��( ��|9�l6)�|���5��R�OH5���=#���SR�?%���9�N�\7K�Py�=�,!�#��r����E2b���h�$��e|��? yEnr������@Y���$�E�?����}�L��g,�cf(�(�����t�I���S�#=q��'q=�������|�0����[�	��~���
�M�`�]c"�����m/;f��~���.x�1R��OS;q��:������G"�0�3�)�?ZPB�U�{��������@�����������6?
��x��[�~��)'8��������w�e�������w&�#�.B��y�)�^*��\�4f�.����~����_���{}+2�Hsu��By������������r��0t��J�q��z�oL��;������A�����m4�^wd�J������>�����x�8�Q��C���k�O
�T����2p.����)a��W�W�z��}};�������V��[q�%8@��>tb�M�bm�U�Vy���|Q�y'���<~bL�^|Q��6�B8ou{	^c	?c[�9�\U��2)��R���``�Tz&6���<��C�dYr>��J�����U�J[;������Z��
���.��
r�K/o`%c?-�E_+U�]�2�V��Vg��������t[��nz�ij=���o�
)����Z)�.�����m������0^q��&�.{�v���$~��o�n�W��~����]����Y����6o�
W�$���kx�<+�w	0� ^�*_�x�o����VtH�+a!U�z�|�2 �f
����L�����^�6��GG��)3A�������r[�]����H<����K1��R@�0t b�g�XN=�8]v_���2�������ps�����l��������M�@N�����u��(W�[���)�J�E���H�%*q��/��@L��D�}���45��qi^SS���7D����+1��+�m���%J���4P����g�b(Xz��|��n�~z^f�n��/�A<��,9U�w�},��`|	y�%�����>�xw�Z�X��h��*�����$�hn�l�����P�����7'`�8�0F��K)6�E�[���O�`�4Z�>������xV���n��p50�����2��@a�����-���6��~-�<�;0�����^��^SQl�F�')DiI����#�	�Xg+����X�N������y�th���	������S�n��Q����W�+)�������t���E��JJ����9FVv76v�[���7��u�(�vR�����(@���o���R�������d�}������&�}�l�O�r�u���g����sGw��Z�-P��My>�i���M����*���`<���f�)���-��
�Lzq��4N:;D�VU+�X�<���_���c�
�g��L�X��*��D�P<������d��<Z'<������nQ+��I�����Klwx����v�^o�X��X�w�mwG��/c�����f����$�,rw��q`��Vyq�4*4Y��S�vF,hJ�v�>�Su����5�'V�n��]���Z�RZ_-��U�y�-CZ�����h��'fw���Y����Y+����)��{y�����������<���DHpZ{]!�i����
.%�����	D��i�?�;����'��B�����K�Wx�M7���?s����z����Z_7�?����x���0����d��?��o��q����}��M�����[��o�7l����������f��=�v�x��x�?�6�~������	������S�Pa�'A��c�d�l����ECv�KECx���`�oZ��Z9�R��@T������
���8��b�^�����w���k[��"���;�A���e�0�����������'P-��AF�I�Ke��F�\��Wai�f�m����E?�P�N7yG�a%�?~�S`�?���&��������s�DZ7.������vk
^�����xgO�v��4�8�g ��r4�,�M��8Nd��i��������|�:�����<S�3����,o?=��I�����p��T�lazYc�]����k�ru��V�Kh
��7��_�`��R�l
��$3:$[����~s>0	�����U^`��o_P(�.������_�AY���Z��`��n��j-N�}k�&�by�LH�[���`�/��_����0�q���5������������-.��-!�J�M�|��V�)����}�N�Ge������4�nt��}�'%
� ����8N��	R1����IM�L����@ID\'�����^B�}�v����ox�����DM����w(��}�8�L����#L4x�}�����"^K�u����a:�q0f�
�+DS���$8�^����;�����_1�/��	e|t�=�d�a^�Y�(���rp#�V:��l�9.�~���<���(�������� 5����5%�U��;!|���8����(a��el[�"	@\�GK�F���)��_�������t��o_��>�-�����i���������rD�Q�u���y�D�����4��o�Osd��m(G_�������!-�/�oB����c"�s?M{�'{��`'�����!� 
K#av�v���0E����}�&C�~��Cjz�����DzQ�o�T�BeC�To�}�7�\	���u^,��AA{�\-m�U�y~`�BL�=	���Z?S���(��3�n������8����x6��QI���'G�sq�5{q�btYl������xx����z��_�/��N��Y���y�x�o���O���E�T���r�^W�C`��������n��RP��v��o�wv+��7K����R�z��p�������?�z\�N�R�)��r�����&�eCJ':��W���o�QMi��@���Z�j�Z<//����p0���n����h��7��U�OE{�"W<��{�r��L���6}�cE�q�������/|l�a:V���#r~z���Y~�,?OV�W�+��F(����o�aN��/��>�`������$���^)��{�[A��9��������������5����~xZ;i�?�#���5���������+6�rm�
�4���>�d-!uZ��S�������o���
#2Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Rod Taylor (#1)
Re: ALTER TABLE modifications

Is this to be applied to CVS HEAD?

---------------------------------------------------------------------------

Rod Taylor wrote:

A general re-organization of Alter Table. Node wise, it is a
AlterTableStmt with a list of AlterTableCmds. The Cmds are the
individual actions to be completed (Add constraint, drop constraint, add
column, etc.)

Processing is done in 2 phases. The first phase updates the system
catalogs and creates a work queue for the table scan. The second phase
is to conduct the actual table scan evaluating all constraints and other
per tuple processing simultaneously, as required. This has no effect on
single step operations, but has a large benefit for combinational logic
where multiple table scans would otherwise be required.

Steps for the table scan include expression processing (default or
transform expressions), not null constraint process, other constraints.

The code has been simplified a little. Simple permission and recursion
checks are conducted in the common area and an enum for the command type
is used rather than a Char.

ALTER TABLE ADD COLUMN col DEFAULT 3 NOT NULL;
Allow creation of a column with a default (filled) and not null
constraint. This is internally subdivided into 3 actions much
like the below syntax.

ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol > 3);
The above combinational syntax is commented out in gram.y. The
support framework is used in both the above and below items, but
arbitrary statements probably have some issues -- I've not
tested enough to determine.

If it is useful, it will be submitted at a later date.

ALTER TABLE tab ALTER COLUMN col TYPE text TRANSFORM ...;
Currently migrates indexes, check constraints, defaults, and the
column definition to the new type with optional transform. If
the tranform is not supplied, a standard assignment cast is
attempted.

One issue is that it detects dependencies way too late in the
game (after the TRANFORM has been applied). I tried mucking up
performDeletion to have a RESTRICT that did not throw the error
at the end (or physically remove the items) but that didn't work
out. Any bright ideas on how to achieve the NOTICES from a
failed DROP COLUMN earlier? Otherwise, I can put in single
object detection at that point.

It does not migrate foreign keys yet (should be easy to add) and
will be forwarded as an independent patch at a later time.
Currently foreign keys are rejected like views, functions, etc.

Comments appreciated.
--
Rod Taylor <pg [at] rbt [dot] ca>

Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: ALTER TABLE modifications

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Is this to be applied to CVS HEAD?

It sounded like large portions were still at the request-for-comment
stage...

regards, tom lane

#4Rod Taylor
pg@rbt.ca
In reply to: Tom Lane (#3)
Re: ALTER TABLE modifications

On Tue, 2003-11-11 at 23:46, Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Is this to be applied to CVS HEAD?

It sounded like large portions were still at the request-for-comment
stage...

It can be applied to -HEAD without breaking anything or backtracking in
feature set (that I can see) but there is substantial change in the way
things work so a pre-review is warranted and I'm sure changes will be
requested.

If I don't receive comments for corrections by the weekend, I'll finish
off one of the missing components (foreign keys) and submit a
replacement.

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Rod Taylor (#1)
Re: ALTER TABLE modifications

Rod Taylor writes:

ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol > 3);
The above combinational syntax is commented out in gram.y. The
support framework is used in both the above and below items, but
arbitrary statements probably have some issues -- I've not
tested enough to determine.

If it is useful, it will be submitted at a later date.

I think it's perfectly fine to write two separate ALTER TABLE statements.
No need to introduce this nonstandard syntax.

ALTER TABLE tab ALTER COLUMN col TYPE text TRANSFORM ...;
Currently migrates indexes, check constraints, defaults, and the
column definition to the new type with optional transform. If
the tranform is not supplied, a standard assignment cast is
attempted.

Please don't use the term "transform". It is used by the SQL standard for
other purposes. What kind of object would you put in place of the "..."
anyway? A function? What syntax do other databases use?

--
Peter Eisentraut peter_e@gmx.net

#6Rod Taylor
pg@rbt.ca
In reply to: Peter Eisentraut (#5)
Re: ALTER TABLE modifications

On Wed, 2003-11-12 at 14:02, Peter Eisentraut wrote:

Rod Taylor writes:

ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol > 3);

I think it's perfectly fine to write two separate ALTER TABLE statements.
No need to introduce this nonstandard syntax.

Yes, it is certainly fine to do so, but much faster to do the above.

The command shown executes nearly 40% faster than 2 independent
statements in a single transaction -- the difference is even more
significant with additional sub-commands.

ALTER TABLE tab ALTER COLUMN col TYPE text TRANSFORM ...;
Currently migrates indexes, check constraints, defaults, and the
column definition to the new type with optional transform. If
the tranform is not supplied, a standard assignment cast is
attempted.

Please don't use the term "transform". It is used by the SQL standard for
other purposes. What kind of object would you put in place of the "..."
anyway? A function? What syntax do other databases use?

I've not found another database which allows this syntax. The suggestion
of TRANSFORM was Toms and was a result of using an assignment cast by
default. Do you have a better term I can use?

http://groups.google.ca/groups?hl=en&amp;lr=&amp;ie=UTF-8&amp;oe=UTF-8&amp;frame=right&amp;th=266b02a270a164aa&amp;seekm=1064805960.60248.24.camel%40jester#link4

The ... is an A_Expr which does not accept (among other things)
subselects. CASE statements, equations, etc. work fine.

CREATE TABLE tab (col int2);
-- integer to boolean
ALTER TABLE tab ALTER col TYPE boolean
TRANSFORM CASE WHEN col >= 1 THEN true ELSE false END;

-- or say Bytes to MBytes (original column is int8)
ALTER TABLE tab ALTER col TYPE integer TRANSFORM col / (1024 * 1024);

#7Hannu Krosing
hannu@tm.ee
In reply to: Peter Eisentraut (#5)
Re: ALTER TABLE modifications

Peter Eisentraut kirjutas K, 12.11.2003 kell 21:02:

Rod Taylor writes:

ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol > 3);
The above combinational syntax is commented out in gram.y. The
support framework is used in both the above and below items, but
arbitrary statements probably have some issues -- I've not
tested enough to determine.

If it is useful, it will be submitted at a later date.

I think it's perfectly fine to write two separate ALTER TABLE statements.

I guess the difference is that each pass (i.e. ALTER TABLE) needs to do
another scan and copy of the table. Putting them in one statement allows
all the alterations to be done in one pass.

No need to introduce this nonstandard syntax.

ALTER TABLE tab ALTER COLUMN col TYPE text TRANSFORM ...;
Currently migrates indexes, check constraints, defaults, and the
column definition to the new type with optional transform. If
the tranform is not supplied, a standard assignment cast is
attempted.

Please don't use the term "transform". It is used by the SQL standard for
other purposes.

Is the "other" use conflicting with this syntax ?

I think we have preferred reusing existing keywords to adding new ones
in the past.

-----------------
Hannu

#8Peter Eisentraut
peter_e@gmx.net
In reply to: Rod Taylor (#6)
Re: ALTER TABLE modifications

Rod Taylor writes:

Yes, it is certainly fine to do so, but much faster to do the above.

Are table schema changes performance-sensitive operations, and are they
usually done in bulk? I doubt it.

I've not found another database which allows this syntax. The suggestion
of TRANSFORM was Toms and was a result of using an assignment cast by
default. Do you have a better term I can use?

I'm not sure I buy this whole concept in the first place. If there is
no cast between type A and type B, then surely changing a table column
from A to B is nonsensical.

-- or say Bytes to MBytes (original column is int8)
ALTER TABLE tab ALTER col TYPE integer TRANSFORM col / (1024 * 1024);

You can do this using a plain column type change plus an UPDATE. I'd
prefer to keep these operations independent.

--
Peter Eisentraut peter_e@gmx.net

#9Peter Eisentraut
peter_e@gmx.net
In reply to: Hannu Krosing (#7)
Re: ALTER TABLE modifications

Hannu Krosing writes:

Please don't use the term "transform". It is used by the SQL standard for
other purposes.

Is the "other" use conflicting with this syntax ?

I think we have preferred reusing existing keywords to adding new ones
in the past.

Maybe (although I don't agree). but we've never intentionally done
terminology overloading.

--
Peter Eisentraut peter_e@gmx.net

#10Rod Taylor
pg@rbt.ca
In reply to: Peter Eisentraut (#8)
Re: ALTER TABLE modifications

On Thu, 2003-11-13 at 09:18, Peter Eisentraut wrote:

Rod Taylor writes:

Yes, it is certainly fine to do so, but much faster to do the above.

Are table schema changes performance-sensitive operations, and are they
usually done in bulk? I doubt it.

Perhaps not for you. But I would disagree with both of those points for
a majority of companies.

If the system has high uptime requirements, the timeframe to accomplish
maintenance decreases substantially. For example, I have two 1.5 hour
maintenance windows per year for maintenance. This is a requirement
given by our clients, nearly all of whom insist on it. Telcos and other
enterprise level environments with 24 / 7 usage patterns have different
demands.

So.. Adding 2 new check constraints to a table with 500million entries
takes way way too much time in my eyes.

Toms request (when I initially brought up fixing ADD COLUMN) was that it
would process the DEFAULT and other new constraints in a single pass.
The above syntax simply uses the framework put in place for ADD COLUMN.

I'll not push it if it does not function with complex combinations,
which has not been tested, as such is not included in this patch.

-- or say Bytes to MBytes (original column is int8)
ALTER TABLE tab ALTER col TYPE integer TRANSFORM col / (1024 * 1024);

You can do this using a plain column type change plus an UPDATE. I'd
prefer to keep these operations independent.

Yes, if you can do the update first.

Ok.. How about boolean to int2 as the user discovered they require a
third or fouth state? Or vice-versa. An MSSQL, MySQL, etc. migration
would leave a bunch of int2's (since they do not support boolean) in the
PostgreSQL database which have a boolean meaning.

rbt=# select '1'::int4::boolean
rbt-# ;
ERROR: cannot cast type integer to boolean
rbt=# select '1'::boolean;
bool
------
t
(1 row)

Are you going to tell these people to write down the Default, add a new
column, copy the data, remove the old column, re-add the default, and
rename the new column to the old column name?

This is the exact reason many folks have asked for this ALTER form to be
added.

Considering there are already 2 sites out there running with this patch
(I have been asked for advance copies) I do not believe the
functionality is overkill in any respect.

Can you please suggest a better term to use in place of TRANSFORM?
Perhaps UPDATE WITH?

#11Hannu Krosing
hannu@tm.ee
In reply to: Rod Taylor (#10)
Re: ALTER TABLE modifications

Rod Taylor kirjutas N, 13.11.2003 kell 16:59:

Can you please suggest a better term to use in place of TRANSFORM?
Perhaps UPDATE WITH?

or perhaps USING, based loosely on our use of USING in CREATE INDEX ?

----------
Hannu

#12Rod Taylor
pg@rbt.ca
In reply to: Hannu Krosing (#11)
Re: ALTER TABLE modifications

-- moved to -hackers

On Thu, 2003-11-13 at 11:35, Hannu Krosing wrote:

Rod Taylor kirjutas N, 13.11.2003 kell 16:59:

Can you please suggest a better term to use in place of TRANSFORM?
Perhaps UPDATE WITH?

or perhaps USING, based loosely on our use of USING in CREATE INDEX ?

USING sounds reasonable to me. Peter?

To those not on -patches, Peter is unhappy with the TRANSFORM clause in:
ALTER TABLE tab ALTER COLUMN col TRANSFORM expression;

The reasoning is that TRANSFORM in the spec means something different
than our use. We're attempting to come up with a replacement term.

#13Dave Cramer
pg@fastcrypt.com
In reply to: Hannu Krosing (#11)
Re: ALTER TABLE modifications

Rod,

I tried the current patch on a RC2 release, and I noticed one
undesirable side affect.

Modifying a column moves it to the end. In high availability situations
this would not be desirable, I would imagine it would break lots of
code.

Dave

Show quoted text

On Thu, 2003-11-13 at 11:35, Hannu Krosing wrote:

Rod Taylor kirjutas N, 13.11.2003 kell 16:59:

Can you please suggest a better term to use in place of TRANSFORM?
Perhaps UPDATE WITH?

or perhaps USING, based loosely on our use of USING in CREATE INDEX ?

----------
Hannu

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

#14Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Dave Cramer (#13)
Re: ALTER TABLE modifications

On Fri, Nov 14, 2003 at 08:59:05AM -0500, Dave Cramer wrote:

I tried the current patch on a RC2 release, and I noticed one
undesirable side affect.

Modifying a column moves it to the end. In high availability situations
this would not be desirable, I would imagine it would break lots of
code.

This is expected. Doing otherwise would incur into a much bigger
performance hit.

Anyway, IMHO no code should use SELECT * in any case, which is the only
scenario where one would expect physical column order to matter, isn't
it?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La primera ley de las demostraciones en vivo es: no trate de usar el sistema.
Escriba un gui�n que no toque nada para no causar da�os." (Jakob Nielsen)

#15Hannu Krosing
hannu@tm.ee
In reply to: Alvaro Herrera (#14)
Re: ALTER TABLE modifications

Alvaro Herrera kirjutas R, 14.11.2003 kell 16:17:

On Fri, Nov 14, 2003 at 08:59:05AM -0500, Dave Cramer wrote:

I tried the current patch on a RC2 release, and I noticed one
undesirable side affect.

Modifying a column moves it to the end. In high availability situations
this would not be desirable, I would imagine it would break lots of
code.

This is expected. Doing otherwise would incur into a much bigger
performance hit.

Not neccessarily, but it would make the patch much bigger ;)

IIRC there was discussion about splitting colum numbers into physical
and logical numbers at the time when DROP COLUMN was done.

Anyway, IMHO no code should use SELECT * in any case, which is the only
scenario where one would expect physical column order to matter, isn't
it?

and this could also break when just changing the column type.

------------
Hannu

#16Rod Taylor
pg@rbt.ca
In reply to: Dave Cramer (#13)
Re: ALTER TABLE modifications

On Fri, 2003-11-14 at 08:59, Dave Cramer wrote:

Rod,

I tried the current patch on a RC2 release, and I noticed one
undesirable side affect.

Modifying a column moves it to the end. In high availability situations
this would not be desirable, I would imagine it would break lots of
code.

Yes, I've done that to myself a few times.

The method is rename old column, add new column, move data across, move
or reform dependencies, drop old column.

Adding the new column puts it to the end. In order to avoid the
repositioning we would need some kind of a position abstraction from the
physical storage to what the user sees. It's on the TODO list, but not a
part of this patch.

#17Peter Eisentraut
peter_e@gmx.net
In reply to: Rod Taylor (#16)
Re: ALTER TABLE modifications

Rod Taylor writes:

The method is rename old column, add new column, move data across, move
or reform dependencies, drop old column.

I can do this by hand. If we have an explicit command to do it, then it
needs to preserve the table schema. Else, this feature would be mostly
useless and a certain source of complaints.

--
Peter Eisentraut peter_e@gmx.net

#18Rod Taylor
pg@rbt.ca
In reply to: Peter Eisentraut (#17)
Re: ALTER TABLE modifications

On Fri, 2003-11-14 at 09:57, Peter Eisentraut wrote:

Rod Taylor writes:

The method is rename old column, add new column, move data across, move
or reform dependencies, drop old column.

I can do this by hand. If we have an explicit command to do it, then it
needs to preserve the table schema. Else, this feature would be mostly
useless and a certain source of complaints.

The method was agreed to on -hackers prior to any code having been
written. Unless I'm mistaken, the method was suggested to me by other on
-hackers.

Can you give me an alternative on how to approach this problem without
relying on another TODO item labelled ALTER TABLE .. POSITION?

The point of the command isn't to accomplish anything magical, simply to
make it easier.

begin;
Rename old column
Add new column
Copy data
Recreate default
Recreate NOT NULL constraint
Recreate index 1
Recreate index 2 (multi-key)
Recreate check constraint 1
Recreate check constraint 2
Recreate check constraint 3
Recreate foreign key 1
remove old column
commit;
vacuum full table (to get rid of 2x problem since the user was unable to
do a fileswap)

The above is by hand, the below is with this command:

begin;
Alter table .. type ..
commit;

If it becomes possible to change the order without having to goto an
exceptional amount of work (that POSITION item) then it would only be
obvious to attempt to preserve the position.

#19Dave Cramer
pg@fastcrypt.com
In reply to: Peter Eisentraut (#17)
Re: ALTER TABLE modifications

OK,

Here is another approach, that would retain column order. It will
require that the table be locked while this proceeds, but I think this
is a good idea anyway.

lock table
create newtable as select c1, c2, c3::newtype
modify pg_class to point to the new filename
modify existing pg_attribute for the column in question
recreate indexes that exist on the column
unlock table

Dave

Show quoted text

On Fri, 2003-11-14 at 09:57, Peter Eisentraut wrote:

Rod Taylor writes:

The method is rename old column, add new column, move data across, move
or reform dependencies, drop old column.

I can do this by hand. If we have an explicit command to do it, then it
needs to preserve the table schema. Else, this feature would be mostly
useless and a certain source of complaints.

#20Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rod Taylor (#18)
Re: ALTER TABLE modifications

Rod Taylor <pg@rbt.ca> writes:

On Fri, 2003-11-14 at 09:57, Peter Eisentraut wrote:

I can do this by hand. If we have an explicit command to do it, then it
needs to preserve the table schema. Else, this feature would be mostly
useless and a certain source of complaints.

The method was agreed to on -hackers prior to any code having been
written.

I believe the consensus was that automating what you could do by hand
is still a step forward.

It clearly would be better if we could relabel the logical column
position after finishing the whole process, but I agree with Rod that
that is an independent patch. Combining them into one mega-patch
doesn't sound like good engineering.

I guess the real question here is whether we would want to revert this
capability if a patch to adjust logical column orderings doesn't appear
before 7.5. My vote would be "no", but apparently Peter's is "yes".
Any other opinions?

regards, tom lane

#21Rod Taylor
pg@rbt.ca
In reply to: Dave Cramer (#19)
Re: ALTER TABLE modifications

lock table
create newtable as select c1, c2, c3::newtype
modify pg_class to point to the new filename
modify existing pg_attribute for the column in question
recreate indexes that exist on the column
unlock table

I actually tried this to start with an ran into several dead-ends in
trying to rebuild constraints, defaults, etc. In order to do this I
think you would need to create a second pg_class entry and do a full
table swap.

By far, the easiest method to preserve order without writing a ton of
additional code is to do something that is on the TODO list already,
separate the visible position from physical position.

Doing the above has lots of added benefits, where spending a ton of time
on TYPE change has very few benefits.

#22Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#20)
Re: ALTER TABLE modifications

Tom Lane writes:

I believe the consensus was that automating what you could do by hand
is still a step forward.

I don't recall that, but if so, I would like to revisit that consensus.

AFAICT, this patch does not buy us anything at all. It's just a different
spelling of existing functionality. We have never done that before. It
just makes the system harder to maintain and use. All commands should be
reasonably independent, or at least add some functionality of their own.

It clearly would be better if we could relabel the logical column
position after finishing the whole process, but I agree with Rod that
that is an independent patch. Combining them into one mega-patch
doesn't sound like good engineering.

Good engineering would be if the logical column number patch comes first.
We cannot possibly leave this patch as is. People expect in-place column
changes. Things will break left and right, users will complain all over
the place if we offer a way to change a column, but yeah, by the way it
changes the structure of the table as well. We've had these kinds of good
idea/right direction/better than nothing approaches in areas like DROP
COLUMN and CLUSTER already, and they were no good. Except in this case,
"better than nothing" doesn't even apply, because there is already
something.

--
Peter Eisentraut peter_e@gmx.net

#23Hannu Krosing
hannu@tm.ee
In reply to: Peter Eisentraut (#22)
Re: ALTER TABLE modifications

Peter Eisentraut kirjutas R, 14.11.2003 kell 18:51:

Tom Lane writes:

I believe the consensus was that automating what you could do by hand
is still a step forward.

I don't recall that, but if so, I would like to revisit that consensus.

AFAICT, this patch does not buy us anything at all. It's just a different
spelling of existing functionality. We have never done that before.

what about DROP COLUMN - this is also just a different spelling for

SELECT INTO, migrate all constraints, DROP OLD TABLE, RENAME.

It just makes the system harder to maintain and use. All commands should be
reasonably independent, or at least add some functionality of their own.

It clearly would be better if we could relabel the logical column
position after finishing the whole process, but I agree with Rod that
that is an independent patch. Combining them into one mega-patch
doesn't sound like good engineering.

Good engineering would be if the logical column number patch comes first.

Agreed, it would be nice.

We cannot possibly leave this patch as is. People expect in-place column
changes.

Does SQL spec even require that SELECT * always returns columns in the
same order ? I don't think that relational model assigns any 'order' to
columns.

BTW, SELECT * is just a different spelling of existing functionality ;)

Things will break left and right, users will complain all over
the place if we offer a way to change a column, but yeah, by the way it
changes the structure of the table as well.

ALTER TABLE ADD/DROP COLUMN would also break SELECT *.

as would type change in many cases (query expects int but gets string)

We've had these kinds of good
idea/right direction/better than nothing approaches in areas like DROP
COLUMN and CLUSTER already, and they were no good. Except in this case,
"better than nothing" doesn't even apply, because there is already
something.

We have always had DUMP -> sed -> LOAD too.

This patch is *MUCH* better than nothing for performance. Instead of
being N times SEQSCAN (+ intervening VACUUM FULLs to reclaim space), it
can do it all in one pass. If that pass takes 1.5 hours, we have a very
big win here.

-----------------
Hannu

#24Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hannu Krosing (#23)
Re: ALTER TABLE modifications

Hannu Krosing <hannu@tm.ee> writes:

Peter Eisentraut kirjutas R, 14.11.2003 kell 18:51:

I don't recall that, but if so, I would like to revisit that consensus.

[ Hannu disagrees ]

Please take this thread to pgsql-hackers; if the issue is going to be
contentious then we should try to get a wider spectrum of opinion than
just people who follow -patches.

regards, tom lane

#25Peter Eisentraut
peter_e@gmx.net
In reply to: Hannu Krosing (#23)
Re: [PATCHES] ALTER TABLE modifications

Hannu Krosing writes:

AFAICT, this patch does not buy us anything at all. It's just a different
spelling of existing functionality. We have never done that before.

what about DROP COLUMN - this is also just a different spelling for

SELECT INTO, migrate all constraints, DROP OLD TABLE, RENAME.

No, because DROP COLUMN preserves dependent objects.

We cannot possibly leave this patch as is. People expect in-place column
changes.

Does SQL spec even require that SELECT * always returns columns in the
same order ?

Yes:

b) Otherwise, the <select list> "*" is equivalent to a <value
expression> sequence in which each <value expression>
is a column reference that references a column of T and
each column of T is referenced exactly once. The columns
are referenced in the ascending sequence of their ordinal
position within T.

I don't think that relational model assigns any 'order' to columns.

Correct, but SQL is not the relational model or vice versa.

BTW, SELECT * is just a different spelling of existing functionality ;)

No, there is no other way to get a complete list of columns. (Hard-coding
does not count.)

--
Peter Eisentraut peter_e@gmx.net

#26Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Alvaro Herrera (#14)
Re: ALTER TABLE modifications

This is expected. Doing otherwise would incur into a much bigger
performance hit.

Anyway, IMHO no code should use SELECT * in any case, which is the only
scenario where one would expect physical column order to matter, isn't
it?

Well, we can always bring back the old idea of a attlognum which is the
logical order of the columns. Then we use that to expand *

Chris

#27Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Tom Lane (#20)
Re: ALTER TABLE modifications

I guess the real question here is whether we would want to revert this
capability if a patch to adjust logical column orderings doesn't appear
before 7.5. My vote would be "no", but apparently Peter's is "yes".
Any other opinions?

The fact that it deals with the nightmare of dropping and recreating
indexes and fk's makes it worth it to me.

How about functions and views and rules that depend on it though?

Chris

#28Hannu Krosing
hannu@tm.ee
In reply to: Rod Taylor (#1)
Re: ALTER TABLE modifications

Rod Taylor kirjutas L, 08.11.2003 kell 18:55:

A general re-organization of Alter Table. Node wise, it is a
AlterTableStmt with a list of AlterTableCmds. The Cmds are the
individual actions to be completed (Add constraint, drop constraint, add
column, etc.)

Processing is done in 2 phases. The first phase updates the system
catalogs and creates a work queue for the table scan. The second phase
is to conduct the actual table scan evaluating all constraints and other
per tuple processing simultaneously, as required. This has no effect on
single step operations, but has a large benefit for combinational logic
where multiple table scans would otherwise be required.

...

ALTER TABLE tab ALTER COLUMN col TYPE text TRANSFORM ...;
Currently migrates indexes, check constraints, defaults, and the
column definition to the new type with optional transform. If
the tranform is not supplied, a standard assignment cast is
attempted.

Do you have special cases for type changes which don't need data
transforms.

I mean things like changing VARCHAR(10) to VARCHAR(20), dropping the NOT
NULL constraint or changing CHECK A < 3 to CHECK A < 4.

All these could be done with no data migration or extra checking.

So how much of it should PG attemt to detect automatically and should
there be NOSCAN option when progremmer knows better
(changing CHECK ABS(A) < 3 into CHECK 9 > (A*A) )

----------------
Hannu

#29Rod Taylor
pg@rbt.ca
In reply to: Hannu Krosing (#28)
Re: [PATCHES] ALTER TABLE modifications

-- moving to -hackers

Do you have special cases for type changes which don't need data
transforms.

I mean things like changing VARCHAR(10) to VARCHAR(20), dropping the NOT
NULL constraint or changing CHECK A < 3 to CHECK A < 4.

There are basically 3 types of change.

The first is simple, a removal. These do not kick off scans of any form.
You simply do not add any work to the post-processing queue.

The second requests a table scan. This is intended for check constraint,
etc. additions.

The third is a rewrite of the records which is done with via a file
swap. All type changes, column + default additions, etc. are done this
way. It will simultaneously take care of the check constraint, etc.
requests as well.

All these could be done with no data migration or extra checking.

I'll leave it for someone else to add in the queue bypasses for simple
items. I've otherwise attempted to maintain the current processes (new
check constraint always scans, etc.).

Queued foreign keys are going to need to work a little differently since
they are cross table checks. I'm currently deferring them until
everything else has been accomplished (affects alter type only at the
moment).