pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Georg M. Sorst <georgsorst@gmx.de>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Loading a dump containing include commands
Date: Wed, 29 Sep 2010 21:57:28 +0800
Message-ID: <4CA345C8.5010902@postnewspapers.com.au> (raw)
In-Reply-To: <4CA30408.4030800@gmx.de>
References: <4CA30408.4030800@gmx.de>

On 29/09/2010 5:16 PM, Georg M. Sorst wrote:
> Hey list!
>
> Is there a way to load a dump with include statements (\i something.sql)
> with the Postgres JDBC driver? Both PGCopyOutputStream and the regular
> Statement seem to choke on \i.

No. \i is a psql-specific instruction. It's not part of the PostgreSQL 
dialect or protocol, it's a utility command in the "psql" interactive 
sql command processor.

You could probably pre-process the input stream to insert includes 
pretty easily, though. Doing it properly and cleanly would require your 
code to be properly aware of quoted blocks, including dollar-quoted 
blocks, but in practice you can probably get away with looking for a 
line-ending followed by a run of zero or more whitespace chars before \i .

-- 
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/



view thread (2+ messages)

Message-ID: <4CA345C8.5010902@postnewspapers.com.au>
Permalink:  ../4CA345C8.5010902@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4CA345C8.5010902@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au, georgsorst@gmx.de
  Subject: Re: Loading a dump containing include commands
  In-Reply-To: <4CA345C8.5010902@postnewspapers.com.au>
  References: <4CA30408.4030800@gmx.de> <4CA345C8.5010902@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox