pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Grace Batumbya <grace.batumbya@senecac.on.ca>
To: pgsql-jdbc@postgresql.org
Subject: PostgreSQL JDBC: bytea column getMetaData().getColumns().getIn("COLUMN_SIZE") ~ 2GB
Date: Tue, 12 Jul 2011 12:10:56 -0400
Message-ID: <4E1C7210.5040505@senecac.on.ca> (raw)

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/;

Message-ID: <4E1C7210.5040505@senecac.on.ca>
Permalink:  ../4E1C7210.5040505@senecac.on.ca/
Also on:    postgresql.org/message-id/4E1C7210.5040505@senecac.on.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: grace.batumbya@senecac.on.ca
  Subject: Re: PostgreSQL JDBC: bytea column getMetaData().getColumns().getIn("COLUMN_SIZE") ~ 2GB
  In-Reply-To: <4E1C7210.5040505@senecac.on.ca>
  References: <4E1C7210.5040505@senecac.on.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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