Thread: Re: PQexec() -- query is too long. Maximum length is 8191

Re: PQexec() -- query is too long. Maximum length is 8191

From
Patrick Atoon
Date:
Hi there,

On 20 Jul 1998, Alan Schunemann <schu@pobox.com> wrote:

> I was attempting to import a large table using the psql -e database < db.out.
> (where db.out is the result of a pg_dump that has been changed to import a new
> data set) However, after reading approx. 191 lines, the load core dumped with
> the error:
>
> PQexec() -- query is too long.  Maximum length is 8191
>
> Any ideas?

Nope. I have the same problem with text fields. If the size of a
text field is getting too big, I get the same result from JDBC:

    java.sql.SQLException: SQL Statement too long

I think our problem might be more structural than it seems. Even
if the SQL query wasn't too long, there would still be a problem
with the size of any text field. Chapter 14 of the PostgreSQL
Programmer's Guide says:

    In Postgres, data values are stored in tuples and individual
    tuples cannot span data pages. Since the size of a data page is
    8192 bytes, the upper limit on the size of a data value is
    relatively low. To support the storage of larger atomic values,
    Postgres provides a large object interface. This interface
    provides file oriented access to user data that has been
    declared to be a large type.

To insert the values into the database there are two built-in
registered functions lo_import and lo_export but these work with
files, whereas I would like to INSERT / UPDATE / SELECT the data
as if it were normal text.

Is that possible? Are there workarounds for handling large chunks
of text in PostgreSQL? Any help would be appreciated.

If you reply to this message, please Cc: me, since I'm not sub-
scribed to this mailinglist.

Greetings,

Patrick

P.S. The limit on the length of the SQL query is of course plain
     silly. If you had a table with 10 text entries of 1k each,
     you would already be in trouble. It's a pesky bug! ;-)
--
_____________________________________________________________
  Patrick Atoon______________<GX> creative online development
  ______________________________________mailto:patricka@gx.nl
  __________________________________________http://www.gx.nl/