Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A9DDE1337B61 for ; Wed, 29 Sep 2010 10:57:50 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 51078-04 for ; Wed, 29 Sep 2010 13:57:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id 77EDC133655C for ; Wed, 29 Sep 2010 10:57:42 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 74B24AED8D; Wed, 29 Sep 2010 21:57:41 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MMf59WfsPML2; Wed, 29 Sep 2010 21:57:35 +0800 (WST) Received: from [10.1.1.5] (203-173-29-204.dyn.iinet.net.au [203.173.29.204]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 72475AEAE2; Wed, 29 Sep 2010 21:57:35 +0800 (WST) Message-ID: <4CA345C8.5010902@postnewspapers.com.au> Date: Wed, 29 Sep 2010 21:57:28 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.12) Gecko/20100914 Thunderbird/3.0.8 MIME-Version: 1.0 To: "Georg M. Sorst" CC: pgsql-jdbc@postgresql.org Subject: Re: Loading a dump containing include commands References: <4CA30408.4030800@gmx.de> In-Reply-To: <4CA30408.4030800@gmx.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201009/83 X-Sequence-Number: 20953 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/