LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-10-2008, 10:57 AM   #1
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Postgresql restore command :: Which one to use?


Hello all,

I've been setting up my backup and restore scheme; and I cam across two ways of restoring from a pg_dumpall

What is the difference between this...

Code:
root@host# psql -U postgres < dumpfile.sql
And this...

Code:
root@host# psql -f dumpfile.sql -U postgres
What is the difference? And if there isn't any; what is the "best practice"?


Thoughts/Suggestions/Complaints?

Thanks,

-C

Last edited by custangro; 06-10-2008 at 11:00 AM.
 
Old 06-17-2008, 05:29 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,749

Rep: Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928Reputation: 5928
From the psql man pages
Quote:
-f filename
--file filename
.
.
.
Using this option is subtly different from writing
psql < filename. In general, both will do what you
expect, but using -f enables some nice features
such as error messages with line numbers. There is
also a slight chance that using this option will
reduce the start-up overhead. On the other hand,
the variant using the shell's input redirection is
(in theory) guaranteed to yield exactly the same
output that you would have gotten had you entered
everything by hand.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to restore files using the restore command ? SKYNAT Linux - Newbie 2 12-28-2007 10:26 PM
PostgreSQL insert command djgerbavore Programming 9 02-01-2005 07:27 PM
postgresql restore problem basbosco Linux - General 0 03-04-2004 12:00 PM
PostgreSQL: executing a .SQL file from command line? J_Szucs Linux - Software 0 09-24-2003 11:49 PM
Restore command chuck77 Linux - General 2 03-26-2002 07:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration