title: pg_dump not using $libdir on Linux for postgis
body: <p>I'm using <code>pg_dump</code> to backup a PostgreSQL (9.0.3) + PostGIS (1.5.2) database that contains several GB of pre-calculated static geographic data. The PostGIS functions are included in the output file.</p>
  
  <p>On Linux the plain-text .SQL output looks like:</p>
  
  <pre><code>CREATE FUNCTION geography_out(geography) RETURNS cstring
      LANGUAGE c IMMUTABLE STRICT
      AS '/opt/PostgreSQL/9.0/lib/postgis-1.5', 'geography_out';
  </code></pre>
  
  <p>On Windows the same .SQL file has:</p>
  
  <pre><code>CREATE FUNCTION geography_out(geography) RETURNS cstring
      LANGUAGE c IMMUTABLE STRICT
      AS '$libdir/postgis-1.5', 'geography_out';
  </code></pre>
  
  <p>In both instances, running <code>pg_config</code> shows the correct value for <code>LIBDIR</code></p>
  
  <ul>
  <li><strong>Linux:</strong> LIBDIR = /opt/PostgreSQL/9.0/lib</li>
  <li><strong>Windows:</strong> LIBDIR = C:/PROGRA~2/POSTGR~1/9.0/lib</li>
  </ul>
  
  <p>It's not guaranteed that ever Linux mirror I'll be restoring to has Postgres installed in the exact same location. Is it possible to force the <code>pg_dump</code> on Linux to use <code>$libdir</code>?</p>
  
  <h2>Update:</h2>
  
  <p>In both cases 9.0.3-1 PostgreSQL installers were downloaded from <a href="http://www.enterprisedb.com/products-services-training/pgdownload" rel="nofollow">EnterpriseDB</a>. PostGIS was installed using the StackBuilder tool that came with the install.</p>
  
  <p>The spatially-enabled database was created following the <a href="http://postgis.refractions.net/docs/ch02.html#id2630392" rel="nofollow">standard PostGIS instructions</a>:</p>
  
  <pre><code>createdb mydb
  createlang plpgsql mydb
  psql -d mydb -f postgis.sql
  psql -d mydb -f spatial_ref_sys.sql
  </code></pre>
  
  <p>Interestingly... On Windows the file <code>postgis.sql</code> (<code>C:\Program Files (x86)\PostgreSQL\9.0\share\contrib\postgis-1.5\postgis.sql</code>):</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION geography_out(geography)
      RETURNS cstring
      AS '$libdir/postgis-1.5','geography_out'
      LANGUAGE 'C' IMMUTABLE STRICT; 
  </code></pre>
  
  <p>Whereas on Linux (<code>/opt/PostgreSQL/9.0/share/postgresql/contrib</code>):</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION geography_out(geography)
      RETURNS cstring
      AS '/opt/PostgreSQL/9.0/lib/postgis-1.5','geography_out'
      LANGUAGE 'C' IMMUTABLE STRICT;
  </code></pre>
  
  <p>So, the PostGIS SQL files that create the PostGIS functions use <code>$libdir</code> on Windows, but the full path on Linux. It's not an issue with pg_dump, but rather sounds like an installer issue.</p>