Search Postgresql Archives

Re: Can pg_restore produce create or replace commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adrian Klaver wrote:
On 01/17/2015 10:05 AM, Berend Tober wrote:
I often work with the output of pg_restore from a custom format dump
file...

Most often, I'm refactoring functions and so don't really want to drop
the function but rather want to do a "create or replace function"...

I am not seeing in the documentation an option to generate the script
with anything but straight "create function" commands.

Is there a way for me to access this functionality (i.e., to generate
"create or replace function" scripts) from the command line?

Not that I know of. Though it should be noted that what you can do with
CREATE OR REPLACE depends a good deal on what constitutes refactoring.
...
"To replace the current definition of an existing function, use CREATE
OR REPLACE FUNCTION. It is not possible to change the name or argument
types...


Indeed. I have run into that occasionally. But currently and most often it has not been much problem as the refactoring is generally internal to the function behavior ... in fact most of them are trigger functions, and since I have adopted a consistent naming convention there are practically never function interface changes.


My solution to this is using scripts for objects and keeping them under
version control. Lately I have been using Sqitch(sqitch.org/). There is
a learning curve, but I am finding it useful.

Oh sqitch is (looks to be) awesome and I wish so much to employ it, but I have not had success it getting it installed. I do use Wheeler's companion tool pgtap, and THAT is totally awesome as well and is making life SO much better. I cannot envision ever again doing data base development without it!

I just wonder how PgAdmin creates the scripts, then. Is that a feature specific to the PgAdmin application then rather than the underlying system and tools?



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux