Re: Path for pgsql \i option?
От | Jason Tan |
---|---|
Тема | Re: Path for pgsql \i option? |
Дата | |
Msg-id | Pine.LNX.3.95.1010911145359.27217I-100000@rebel.rebel.net.au обсуждение исходный текст |
Ответ на | Path for pgsql \i option? (Francisco Reyes <lists@natserv.com>) |
Ответы |
Re: Path for pgsql \i option?
|
Список | pgsql-novice |
You can specify absolute paths. contacts=# \! pwd /home/jtan contacts=# \! ls /home/jtan/Projects/contacts/db : basedata builddb.sql granter.pl plpgsql.sql ;w basedata.sql entitydb.sql log tables RCS belongs_to_org.sql flech logger.sql testdata.sql Table1.txt belongs_to_org2.sql grant_apache pids testfunc contacts=# \i /home/jtan/Projects/contacts/db/testdata.sql The above will work. You can also speicify relative paths: contacts=# \!pwd contacts=# \! ls .. : basedata builddb.sql granter.pl plpgsql.sql ;w basedata.sql entitydb.sql log tables RCS belongs_to_org.sql flech logger.sql testdata.sql Table1.txt belongs_to_org2.sql grant_apache pids testfunc contacts=# /home/jtan/Projects/contacts/db/flech contacts=# \i ../testdata.sql You can also include lots of \i directives in a file you run with \i. Eg if have a file called builddb.sq; that contains: \i schema.sql \i /home/cotnacts/data/base/data.sql \i ../testdata.sql You can then go: \i builddb.sql and it will try to run a file in the crrent dir called schema.sql it will run that and it will run /home/contacts/data/base/data.sql it will then run ../testdata.sql. You can find this stuff our really easily by trying it. Jason On Tue, 11 Sep 2001, Francisco Reyes wrote: > I have a number of files I need to include during my database design and > testing. > > Is there a way to specify some form of path for pgsql so when I use "\i" > it would know what directory to try and load the file from? > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- ------------------------------------------------------------------------------ Jason Tan jason@rebel.net.au "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." ~Benjamin Franklin, 1759 ------------------------------------------------------------------------------
В списке pgsql-novice по дате отправления: