pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Backing up views, functions
4+ messages / 3 participants
[nested] [flat]

* Backing up views, functions
@ 2005-12-08 06:53  Benjamin Arai <barai@cs.ucr.edu>
  0 siblings, 3 replies; 4+ messages in thread

From: Benjamin Arai @ 2005-12-08 06:53 UTC (permalink / raw)
  To: pgsql-admin

I have a database of several million records and we are currently 
developing pl functions and views.  How do you dump only the code for 
views and functions?

Benjamin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Backing up views, functions
@ 2005-12-08 07:55  Michael Fuhr <mike@fuhr.org>
  parent: Benjamin Arai <barai@cs.ucr.edu>
  2 siblings, 0 replies; 4+ messages in thread

From: Michael Fuhr @ 2005-12-08 07:55 UTC (permalink / raw)
  To: Benjamin Arai <barai@cs.ucr.edu>; +Cc: pgsql-admin

On Wed, Dec 07, 2005 at 10:53:37PM -0800, Benjamin Arai wrote:
> I have a database of several million records and we are currently 
> developing pl functions and views.  How do you dump only the code for 
> views and functions?

pg_dump doesn't allow you to be that selective, but you could use
the --schema-only option to dump everything except the data.  If
you use one of the non-text dump formats then you could selectively
restore objects with pg_restore.  See the pg_restore documentation
for the -l/--list and -L/--use-list options and the example near the
bottom of the page.

Some people maintain the code for functions and views outside the
database, perhaps under a version control system, and then reload
it when they make changes.

-- 
Michael Fuhr



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Backing up views, functions
@ 2005-12-08 15:07  Bricklen Anderson <banderson@presinet.com>
  parent: Benjamin Arai <barai@cs.ucr.edu>
  2 siblings, 0 replies; 4+ messages in thread

From: Bricklen Anderson @ 2005-12-08 15:07 UTC (permalink / raw)
  To: Benjamin Arai <barai@cs.ucr.edu>; +Cc: pgsql-admin

Benjamin Arai wrote:
> I have a database of several million records and we are currently 
> developing pl functions and views.  How do you dump only the code for 
> views and functions?
> 
> Benjamin
> 
This has come up before, if you search the archives, you'll find various 
ways of accomplishing this.
Here's a start (one way of getting function source)
http://archives.postgresql.org/pgsql-general/2005-10/msg01633.php



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Backing up views, functions
@ 2005-12-08 15:32  Bricklen Anderson <banderson@presinet.com>
  parent: Benjamin Arai <barai@cs.ucr.edu>
  2 siblings, 0 replies; 4+ messages in thread

From: Bricklen Anderson @ 2005-12-08 15:32 UTC (permalink / raw)
  To: Benjamin Arai <barai@cs.ucr.edu>; +Cc: pgsql-admin

Benjamin Arai wrote:
> I have a database of several million records and we are currently 
> developing pl functions and views.  How do you dump only the code for 
> views and functions?
> 
> Benjamin
> 
Also, one way of recreating views:

select 'drop view '||viewname||'; CREATE OR REPLACE view '||viewname||' 
as '||definition||'\n' from pg_views where schemaname='public';



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-12-08 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-12-08 06:53 Backing up views, functions Benjamin Arai <barai@cs.ucr.edu>
2005-12-08 07:55 ` Michael Fuhr <mike@fuhr.org>
2005-12-08 15:07 ` Bricklen Anderson <banderson@presinet.com>
2005-12-08 15:32 ` Bricklen Anderson <banderson@presinet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox