PostgreSQL JDBC: bytea column getMetaData().getColumns().getIn("COLUMN_SIZE") ~ 2GB

From: Grace Batumbya <grace(dot)batumbya(at)senecac(dot)on(dot)ca>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: PostgreSQL JDBC: bytea column getMetaData().getColumns().getIn("COLUMN_SIZE") ~ 2GB
Date: 2011-07-12 16:10:56
Message-ID: 4E1C7210.5040505@senecac.on.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi there,
I am using postgresql-9.0-801.jdbc3, on postgresql 9.0.4.
On a bytea column, getMetaData().getColumns().getIn("COLUMN_SIZE")
returns 2147483647 yet from asking around on #postgresql on irc, the
bytea has a limit just less than 1GB.

I did a bit of looking around in the jdbc driver and found this method
in: org.postgresql.jdbc2.TypeInfoCache
public int getPrecision(int oid, int typmod) {
oid = convertArrayToBaseOid(oid);
switch (oid) {
...
case Oid.TEXT:
case Oid.BYTEA:
default:
return _unknownLength;
}
}

Why then does jdbc return 2GB instead of 1GB?

--
*Grace Batumbya*
Research Assistant | Seneca CDOT
Phone: 416-491-5050 x3548
cdot.senecac.on.ca <http://cdot.senecac.on.ca/>

Browse pgsql-jdbc by date

  From Date Subject
Next Message Akio Iwaasa 2011-07-15 11:28:58 org.postgresql.jdbc4.Jdbc4Array.free() is not yet implemented
Previous Message Radosław Smogura 2011-07-07 13:34:34 Re: Help me start postmaster on a default installation of PostgreSQL.