Dumping of views -- done!
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I just spent most of the day learning pg_dump and modifing it so it would
dump views also.
This is the first time I have ever contributed any code changes, so I'm
not sure of how to submit it.
The diff's and a readme as a tgz file are attached.
Thanks
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.
Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!
Attachments:
viewdump.diff.tgzapplication/octet-stream; name=viewdump.diff.tgzDownload
� �v6 �Z�W�����W���#h@@�����ki����`���OLH
I��H=�����MBD������)G�����gfg>a{���|�{��R��Z�&<�vk7�MR����Z��f���7���n��@�q�Rp�� O<����x��}�����*c����.��4��bSGf0���;&�q��m�&���]��(�Ln`h�\ ]_���:��.���XwF�3���k����Ce�iP<��Lp\9vF�|�6`�n�7���wj�6H+iPi�F}�^]����#aWSG#���E�0�/;���+p�"�p��'���"�l����W��/�#�pD2�f6BZ���g��n���`��p}f���5A9fh��
lt��A��Ho�?��,�Q?���7d���m-������79j��7@��8�-�JA�������f�Q]�(�rM���t�dCX��0rv��p�������C����!�:����|�����>{A���[�^�SAA��x�/��~i3r/�����qe9�����������N�c!����t:�&Z����H��*��q��;��wwZ;Q��5-��F�������$h�tG���`(��-xg�4��z���A}o�Y�R� ���K�I��1�H��]���S�S��i�{�h������&�m�Cg��-fQ��K��a� &�V�W�cH����_�>�v^��_�kP8y�n
l�6�j��X(x�{K^c�����o>������w������}����xWytk5����cv/E�Ykk�f=D].-ljFK+����S�f�_B�4Qq�7����G��a1�B��'�rT�������
i�m����qZ���dI��L��u��*ln����q���@��Ba��;�� ��y��L
|f;���,
�E7��c}TO���� ��q�������/��I���pj�a��v�SA\������#�����*�����u;`%�M?�e h�;�s_���r��B!t�����FXFE�fC�r�%����pl��SS�r�� 2$�E'������a�
m�5��,U�U���f����[�y��[����L$#@����X�+�5y�x�7���� �B�#�t���.'��3J(��h�0��{f��H��75����|}������5��Y�18?9��w���W�e����,�;�*�)����D�����Q`_,q�X�oB;�'��rB�v`��Qt)�������g����-�a��,����:j��{����z�/�_N��J����#��J5I�%�'Ws���!��"��H���$�U�Za��Sz�������� Z�"b]5#�{ VxF�e.�T8g=C:U4��A��o^r/��jP��AH;,J���d`���k���M��z ��u\���e1� ze�����h��Zcww7*�alK�,���ox�s���o4�5��h"L*kZ���<x���L�kl��h�K��8z�������j���3|1B�=g��JK��l�S���Uy��3�4�(���aP)Sj�y �������9��~���J�'��\���4��n_�B�V[i��>��������}kKa]�"4�|�w����O��s
�6������bzwFb�;��G4@n�k�����P_��b ��VES!j���s��i��r�RW�5�$oJI�(�� �����T���GdS9��#JO�r���q��$@+��{���Y���'������o����!���n�V�!|�q��*�XY
���r��:/�:���)Yf}������>�%}��N��p���6��md#"���M�+�����0�����rFl�������@.>�Rar4f�d�+���I%k
�%���Y�,"^�x�������{x<�#q��)�Q�
w��d�R9�j.������B��)t��i�%����\�����r^������q��������^��$�5Q�~�s�r�$tj� �U��C��
���Y��u-
�t,�� L-��L�O8[}�/~.��)E�����u�Hx���D�)t�
��E��F��������k!#�K���TF��~W�cD�7�U��F��F]�qiP��e-���D&v�"�Mx!��)��2�[����q��2H��,n-����q1'HT��2���r���M�fV�4��]������ ��7���A�#�t�X��1���#i����2�I��� �6��^
�w���"z���9�7���g%����0�����/k���/����]�oe�w��;�����.�-7�ig��8d��,�3��p�W�;�h��"����-����E"�H)0,u��2���Z��c�*]��9�q�2��#���Dgx�_v��l������������v~��g����qa0�3]��N��i��������^���4�e���ZZ�>;]���p�k|�I���e��B./�����M����umLD�s��%�UCZ/K�\2������$����%�\r�%�\r�%�\r�%�\r�%�\r�%�\r�%�\r�%�\r�%�\r�%�\r���Z9,� P Hi all
Is it too late to add a feature to pg_dump for 6.4??
I just spent most of the day learning pg_dump and modifing it so it would
dump views also.This is the first time I have ever contributed any code changes, so I'm
not sure of how to submit it.The diff's and a readme as a tgz file are attached.
Thanks
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.
I though we dumped views already. If not, I am inclinded to apply it,
but want to see what others say. I thought Jan was working on this, or
was that just rewrite rules? Are you using his code? I know there is
an item on the Open Items list that talks about this:
have psql dump out rules text with new function
Is that what this is?
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Hi Bruce
On Sat, 3 Oct 1998, Bruce Momjian wrote:
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I though we dumped views already. If not, I am inclinded to apply it,
OH, ... well, if it does, I sure would like to know how, I missed it.
but want to see what others say. I thought Jan was working on this, or
was that just rewrite rules? Are you using his code? I know there is
I tryed to stay as much in style with the code that was there as possible.
an item on the Open Items list that talks about this:
have psql dump out rules text with new function
Is that what this is?
I'm not sure that is the same, what my change does is add:
CREATE VIEW viewname AS select clause......;
to the dump file.
I did notice that if used with '-z' it also puts the revoke grant
statments there too. Not my doing, just nice.
At this time there are no provisions (by me any way) to dump any
associated update/delete rules on the view. Unless, like -z above, it
already works?
To the best of my knowlage this feature does not yet exist, if any one
else is working on it, I don't know.
-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Have a great day
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.
Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!
Hi Bruce
On Sat, 3 Oct 1998, Bruce Momjian wrote:
I though we dumped views already. If not, I am inclinded to apply it,
Your comment gave me cause to go read the pg_dump man page again, here is
what it has to say:
rules and views
pg_dump does not understand user-defined rules and
views and will fail to dump them properly. (This
is due to the fact that rules are stored as plans
in the catalogs and not textually)
Now, I did not (yet) do any thing about rules, only views.
Have a great day
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.
Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!
On Sat, 3 Oct 1998, Bruce Momjian wrote:
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I just spent most of the day learning pg_dump and modifing it so it would
dump views also.This is the first time I have ever contributed any code changes, so I'm
not sure of how to submit it.The diff's and a readme as a tgz file are attached.
Thanks
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.I though we dumped views already. If not, I am inclinded to apply it,
but want to see what others say.
As this does not affect, in any way, shape or form, the backend...I'd be
inclined to say go for it also...
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org
scrappy@{postgresql|isc}.org ICQ#7615664
Terry Mackintosh wrote:
Hi Bruce
On Sat, 3 Oct 1998, Bruce Momjian wrote:
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I though we dumped views already. If not, I am inclinded to apply it,
OH, ... well, if it does, I sure would like to know how, I missed it.
No we didn't. I just mentioned that it would be possible with
the new rule utility functions.
but want to see what others say. I thought Jan was working on this, or
was that just rewrite rules? Are you using his code? I know there isI tryed to stay as much in style with the code that was there as possible.
Took a look at the patch. Terry's using the new system view
pg_views for it. But...
an item on the Open Items list that talks about this:
have psql dump out rules text with new function
Is that what this is?I'm not sure that is the same, what my change does is add:
CREATE VIEW viewname AS select clause......;
to the dump file.I did notice that if used with '-z' it also puts the revoke grant
statments there too. Not my doing, just nice.At this time there are no provisions (by me any way) to dump any
associated update/delete rules on the view. Unless, like -z above, it
already works?To the best of my knowlage this feature does not yet exist, if any one
else is working on it, I don't know.
Not me. But I think I should assist since I'm one of the
rulegurus here on the list.
IMHO the better way would be to dump views as regular CREATE
TABLE statements and just omit the data (views have none).
After all tables are restored and all functions, operators
and operator classes are created, we should dump rules using
the pg_rules view.
The checks in pg_dump if a table is a view rely on the
existence of a rule named _RETtablename. I'll add another
check to rewriteDefine.c making sure that a rewrite rule ON
SELECT follows this convention (rules ON SELECT are now
restricted to view rules at all so it would make sense for
me).
I'll add double quotes around identifiers in the output of
pg_get_ruledef() and pg_get_viewdef().
Terry, would you mind to implement dumping of views again in
the above mentioned way? This would cover rewrite rules at
all. A good place to dump rules would be where triggers get
dumped (if they are dumped at all). Dumping all rules would
automagically turn the formerly created tables into views.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #
Hi Jan
On Mon, 5 Oct 1998, Jan Wieck wrote:
Took a look at the patch. Terry's using the new system view
pg_views for it. But...IMHO the better way would be to dump views as regular CREATE
TABLE statements and just omit the data (views have none).
After all tables are restored and all functions, operators
and operator classes are created, we should dump rules using
the pg_rules view.
Well, if you see need to do it differant, you most certainly know more
about it then me, so sure.
I am confused though ....
How is "CREATE TABLE ...." going to become "CREATE VIEW ....."????
Note also, that the way I did it kept in mind that some day we will have
outer joins, at which time most of the code I put in getTables() can come
out, and just make a very minor change to the main query to get the view
info all at one time.
If there is a cleaner way to do it though, then that is the way to do it,
I just do not understand what it is you said.
I am lacking time today to really think about it, but will take time
tonight maybe to look at pg_rules and such.
Have a great day
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.
Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I just spent most of the day learning pg_dump and modifing it so it would
dump views also.This is the first time I have ever contributed any code changes, so I'm
not sure of how to submit it.The diff's and a readme as a tgz file are attached.
Applied, and I have updated the manual pages, and the sgml docs. Yoo,
whooo.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Applied, and I have updated the manual pages, and the sgml docs. Yoo,
whooo.
That sgml is pretty exciting, eh? Now calm down and get back to work :)
- Tom
Applied, and I have updated the manual pages, and the sgml docs. Yoo,
whooo.That sgml is pretty exciting, eh? Now calm down and get back to work :)
I actually have a hardcover SGML book, called "Readme.1st: SGML for
Writers and Editors".
I have not really looked through it, but it was only $7. It is a
Prentice Hall book, 1996.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
I actually have a hardcover SGML book, called "Readme.1st: SGML for
Writers and Editors".
Without having seen the book, I will make the comment that the SGML
books I've run into (not very many, but that won't stop me from
generalizing :) tend to tell you what you could do with SGML, rather
than telling you how to do something with the particular implementation
we are using (DocBook).
The fellow who wrote and maintains the "Modular Style Sheets", Norm
Walsh, is in the middle of writing a book (Nutshell? can't remember) on
DocBook, and presumably his style sheets.
The most useful single information source I've found so far, other than
stealing markup from other parts of the documentation, is the DocBook
element dictionary at the O'Reilly site:
http://www.ora.com/homepages/dtdparse/docbook/3.0/
I hope this is mentioned in our docguide...
- Tom
I haven't seen any comments on this yet...am tempted to add it in,
considering we have another 2 weeks before release, and it doesn't affect
the backend...
Anyone want to comment? If I hear nothing by, say, Monday morning, I'll
apply these...
On Sat, 3 Oct 1998, Terry Mackintosh wrote:
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I just spent most of the day learning pg_dump and modifing it so it would
dump views also.This is the first time I have ever contributed any code changes, so I'm
not sure of how to submit it.The diff's and a readme as a tgz file are attached.
Thanks
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org
scrappy@{postgresql|isc}.org ICQ#7615664
Hi Marc
On Mon, 12 Oct 1998, Marc G. Fournier wrote:
I haven't seen any comments on this yet...am tempted to add it in,
considering we have another 2 weeks before release, and it doesn't affect
the backend...
Hugh?-)
There were lots, any way it prompted Jan to do some major work that did
this and much more, so it is all done as far as I know.
Thanks for asking though, have a great night.
Anyone want to comment? If I hear nothing by, say, Monday morning, I'll
apply these...On Sat, 3 Oct 1998, Terry Mackintosh wrote:
Hi all
Is it too late to add a feature to pg_dump for 6.4??
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.
Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!
I haven't seen any comments on this yet...am tempted to add it in,
considering we have another 2 weeks before release, and it doesn't affect
the backend...Anyone want to comment? If I hear nothing by, say, Monday morning, I'll
apply these...
Stop - don't apply.
Dumping of views is already done in the current CVS. Pg_dump
now outputs CREATE TABLE for view relations too, but no data.
At the end of the schema (after data for real tables has been
filled in) it outputs commands to recreate ALL rewrite rules,
silently turning the tables into the views they where at dump
time.
On Sat, 3 Oct 1998, Terry Mackintosh wrote:
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I just spent most of the day learning pg_dump and modifing it so it would
dump views also.This is the first time I have ever contributed any code changes, so I'm
not sure of how to submit it.The diff's and a readme as a tgz file are attached.
Thanks
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org
scrappy@{postgresql|isc}.org ICQ#7615664
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #
On Tue, 13 Oct 1998, Jan Wieck wrote:
I haven't seen any comments on this yet...am tempted to add it in,
considering we have another 2 weeks before release, and it doesn't affect
the backend...Anyone want to comment? If I hear nothing by, say, Monday morning, I'll
apply these...Stop - don't apply.
Dumping of views is already done in the current CVS. Pg_dump
now outputs CREATE TABLE for view relations too, but no data.
At the end of the schema (after data for real tables has been
filled in) it outputs commands to recreate ALL rewrite rules,
silently turning the tables into the views they where at dump
time.
D'oh...I hate losing a hard drive :( catching up takes soooo long
to do :(
On Sat, 3 Oct 1998, Terry Mackintosh wrote:
Hi all
Is it too late to add a feature to pg_dump for 6.4??
I just spent most of the day learning pg_dump and modifing it so it would
dump views also.This is the first time I have ever contributed any code changes, so I'm
not sure of how to submit it.The diff's and a readme as a tgz file are attached.
Thanks
Terry Mackintosh <terry@terrym.com> http://www.terrym.com
sysadmin/owner Please! No MIME encoded or HTML mail, unless needed.Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org
scrappy@{postgresql|isc}.org ICQ#7615664Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #
Marc G. Fournier scrappy@hub.org
Systems Administrator @ hub.org
scrappy@{postgresql|isc}.org ICQ#7615664