dbTalk Databases Forums  

How to read data from a file?

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss How to read data from a file? in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kynn@panix.com
 
Posts: n/a

Default How to read data from a file? - 02-08-2004 , 11:04 AM









Is there a way to initialize tables by reading the data from a regular
text file?

Thanks!

kynn

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #2  
Old   
kynn@panix.com
 
Posts: n/a

Default Re: How to read data from a file? - 02-08-2004 , 11:19 AM









Sorry, I meant to add this to the post quoted below. I'm still trying
to find the mother-lode of useful PostgreSQL info for beginners. I
looked at *4* PG books yesterday at the bookstore (Douglas & Douglas,
Momjian, Stinson, and the one published by O'Reilly). *None* of them
answered the question quoted below (or if they did, I couldn't find
their answers using the index and the table of contents, which is just
as bad as not giving the answer at all), so I decided none was worth
buying. (I had been warned about how poor PG books are, so this did
not come as a surprise.)



Date: Sun, 8 Feb 2004 12:04:54 -0500 (EST)
From: <kynn (AT) panix (DOT) com>


Is there a way to initialize tables by reading the data from a regular
text file?

Thanks!

kynn

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #3  
Old   
Stephan Szabo
 
Posts: n/a

Default Re: How to read data from a file? - 02-08-2004 , 11:30 AM



On Sun, 8 Feb 2004 kynn (AT) panix (DOT) com wrote:

Quote:
Is there a way to initialize tables by reading the data from a regular
text file?
That depends on the definition of regular. COPY (and \copy in psql)
allow importing of data from a delimited text file with one line per row.

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



Reply With Quote
  #4  
Old   
Bill Moseley
 
Posts: n/a

Default Re: How to read data from a file? - 02-08-2004 , 11:35 AM



On Sun, Feb 08, 2004 at 12:04:54PM -0500, kynn (AT) panix (DOT) com wrote:
Quote:
Is there a way to initialize tables by reading the data from a regular
text file?
Define "regular".

How about:

psql -d databse -f regular_text_file.sql


--
Bill Moseley
moseley (AT) hank (DOT) org


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Reply With Quote
  #5  
Old   
kynn@panix.com
 
Posts: n/a

Default Re: How to read data from a file? - 02-08-2004 , 12:00 PM





Thanks for all replies. From them I was able to find the "\i"
command, which is what I was looking for.

kynn

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.