Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6E006B5DBFE for ; Tue, 12 Jul 2011 13:12:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 10957-04 for ; Tue, 12 Jul 2011 16:12:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mercury.senecac.on.ca (mercury.senecac.on.ca [142.204.1.13]) by mail.postgresql.org (Postfix) with ESMTP id 6C15BB5DBFC for ; Tue, 12 Jul 2011 13:11:59 -0300 (ADT) MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_t08/uObCzpidVb0mQTXdYA)" Received: from [142.204.133.122] by mercury.senecac.on.ca (Sun Java(tm) System Messaging Server 6.3-8.03 (built Apr 24 2009; 32bit)) with ESMTPS id <0LO800LHCABYC0D0@mercury.senecac.on.ca> for pgsql-jdbc@postgresql.org; Tue, 12 Jul 2011 12:11:58 -0400 (EDT) Original-recipient: rfc822;pgsql-jdbc@postgresql.org Message-id: <4E1C7210.5040505@senecac.on.ca> Date: Tue, 12 Jul 2011 12:10:56 -0400 From: Grace Batumbya User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 To: pgsql-jdbc@postgresql.org Subject: PostgreSQL JDBC: bytea column getMetaData().getColumns().getIn("COLUMN_SIZE") ~ 2GB X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.909 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/15 X-Sequence-Number: 22019 This is a multi-part message in MIME format. --Boundary_(ID_t08/uObCzpidVb0mQTXdYA) Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT 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 --Boundary_(ID_t08/uObCzpidVb0mQTXdYA) Content-type: text/html; charset=ISO-8859-1 Content-transfer-encoding: 7BIT 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
--Boundary_(ID_t08/uObCzpidVb0mQTXdYA)--