From: | Tim Landscheidt <tim(at)tim-landscheidt(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: loading many queries from a file |
Date: | 2010-07-01 00:49:12 |
Message-ID: | m3mxucauwn.fsf@passepartout.tim-landscheidt.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Szymon Guz <mabewlun(at)gmail(dot)com> wrote:
> I've got a file with many SQL queries, also some function definitions and so
> on. I'd like to load it to database, but using some library like
> JDBC/ODBC/DBI, not using the obvious psql. Do you know how I could load
> those many queries? Usually there could be loaded only one query, I saw that
> psql parses the file looking for the semicolon.
> Is there any other way than parsing the file and loading queries one by one?
Is your file "friendly" or arbitrary? With DBI, you can exe-
cute several commands in one do() call, but you cannot split
one command across several calls. The PostgreSQL frontend/
backend protocol seems to allow that by a cursory look, but
that's *very* far from JDBC/ODBC/DBI.
If there are no guarantees on the format of your file, I
would try to adapt psql's psqlscan.l & Co.
Tim
From | Date | Subject | |
---|---|---|---|
Next Message | Zoid | 2010-07-01 02:35:49 | Re: LINE 1: IDENTIFY_SYSTEM error infinitum |
Previous Message | Scott Marlowe | 2010-07-01 00:16:29 | Re: left outer join fails because "column .. does not exist in left table?" |