<p>I'm new to postgreSQL and I have a simple question:</p>

<p>I'm trying to create a simple script that creates a DB so I can later call it like this:</p>

<pre><code>psql -f createDB.sql
</code></pre>

<p>I want the script to call other scripts (separate ones for creating tables, adding constraints, functions etc), like this:</p>

<pre><code>\i script1.sql
\i script2.sql
</code></pre>

<p>It works fine provided that createDB.sql is in the <strong>same dir</strong>.</p>

<p>But if I move script2 to a directory under the one with createDB, and modify the createDB so it looks like this:</p>

<pre><code>\i script1.sql
\i somedir\script2.sql
</code></pre>

<p>I get an error:</p>

<blockquote>
  <p>psql:createDB.sql:2: somedir: Permission denied</p>
</blockquote>

<p>I'm using Postgres Plus 8.3 for windows, default postgres user.</p>

<p><strong>EDIT:</strong></p>

<p>Silly me, unix slashes solved the problem.</p>

Postgres started on Linux/Unix.  I suspect that reversing the slash with fix it.
```
```
\i somedir/script2.sql
```
```
If you need to fully qualify something
```
```
\i c:/somedir/script2.sql
```
```
If that doesn't fix it, my next guess would be you need to escape the backslash.
```
```
\i somedir\\script2.sql
```
```