Re: how to load a sql-file????
От | will trillich |
---|---|
Тема | Re: how to load a sql-file???? |
Дата | |
Msg-id | 20010328165555.A16380@mail.serensoft.com обсуждение исходный текст |
Ответ на | Re: how to load a sql-file???? (Marek Pętlicki <marpet@buy.pl>) |
Ответы |
Re: how to load a sql-file????
|
Список | pgsql-general |
On Thu, Mar 29, 2001 at 12:17:31AM +0200, Marek Pêtlicki wrote: > On Tuesday, March, 2001-03-27 at 21:42:39, markus jais wrote: > > hi, > > maybe this is somewhere in the docs but I couldn't find > > it. > > I am a beginner to postgresql and do not know much till now. > > I have bought a book on SQL and now I want to > > import the sample databases into postgresql > > they are provided as *.sql. > > > > in MySQL I can type something like in Bash on my linux box: > > > > $ mysql -u root -p < file.sql > > > > then the file file.sql is read. > > > > can you tell me how to do this with postgresql??? > > thanks a lot. > > very similar: > > psql dbname username < file.sql > > should work > > (you can well omit username if it is the same as your login name) if your sql is flawless, go right ahead. since psql reads "<file" from its STDIN, it won't include any line numbers to help you track down troubles. (as far as it's concerned, you're just typing reeeeal fast, so the feedback would occur right as you type, so line numbers would be superfluous.) on the other hand, both psql -f file-containing-sql mydb and psql mydb mydb=> \i file-containing-sql will spit out error messages including line numbers to help you debug your sql. -- It is always hazardous to ask "Why?" in science, but it is often interesting to do so just the same. -- Isaac Asimov, 'The Genetic Code' will@serensoft.com http://newbieDoc.sourceforge.net/ -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
В списке pgsql-general по дате отправления: