Re: Path for pgsql \i option? - Mailing list pgsql-novice

From Jason Tan
Subject Re: Path for pgsql \i option?
Date
Msg-id Pine.LNX.3.95.1010911145359.27217I-100000@rebel.rebel.net.au
Whole thread Raw
In response to Path for pgsql \i option?  (Francisco Reyes <lists@natserv.com>)
Responses Re: Path for pgsql \i option?  (Francisco Reyes <lists@natserv.com>)
List 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 by date:

Previous
From: Jason Tan
Date:
Subject: Re: Insert using a subselect?
Next
From: Bo Lorentsen
Date:
Subject: accumulate setof ?