pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Loading a dump containing include commands
2+ messages / 2 participants
[nested] [flat]

* Loading a dump containing include commands
@ 2010-09-29 09:16 Georg M. Sorst <georgsorst@gmx.de>
  2010-09-29 13:57 ` Re: Loading a dump containing include commands Craig Ringer <craig@postnewspapers.com.au>
  0 siblings, 1 reply; 2+ messages in thread

From: Georg M. Sorst @ 2010-09-29 09:16 UTC (permalink / raw)
  To: pgsql-jdbc

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.

I am using postgresql-8.4-701.jdbc4.jar, the current Maven version.

Thanks and best regards,
Georg

-- 
Georg M. Sorst
http://vergiss-blackjack.de



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Loading a dump containing include commands
  2010-09-29 09:16 Loading a dump containing include commands Georg M. Sorst <georgsorst@gmx.de>
@ 2010-09-29 13:57 ` Craig Ringer <craig@postnewspapers.com.au>
  0 siblings, 0 replies; 2+ messages in thread

From: Craig Ringer @ 2010-09-29 13:57 UTC (permalink / raw)
  To: Georg M. Sorst <georgsorst@gmx.de>; +Cc: pgsql-jdbc

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/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2010-09-29 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-09-29 09:16 Loading a dump containing include commands Georg M. Sorst <georgsorst@gmx.de>
2010-09-29 13:57 ` Craig Ringer <craig@postnewspapers.com.au>

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