pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Luis Flores <luiscamposflores@gmail.com>
Cc: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: bug report: slow getColumnTypeName
Date: Fri, 12 Oct 2012 18:06:37 +0800
Message-ID: <5077EBAD.5060708@ringerc.id.au> (raw)
In-Reply-To: <DBAC0636-546F-4864-9E01-E21D25050C71@gmail.com>
References: <CAMiEbch4MsNhkTamK3dt4GpJ8qU0BObYPmMNGkrzVFLjwONMpQ@mail.gmail.com>
	<CAMiEbchygfLbpytyOdDXL3-ORjMD76u_0MqwX9QROzCkHUUp0Q@mail.gmail.com>
	<50745541.8060204@ttc-cmc.net>
	<CA+nXnG8thQTe6D-njQYqQUd-LuXD2--RBejCz6Oq7dtMUEEs=g@mail.gmail.com>
	<CA+nXnG-xy8GvVj1gH0f0evuL0uvyw9f87zQVks_zzyuY7ZJEFA@mail.gmail.com>
	<CA+nXnG_Ma7c2kjsQJPDQMwXtsJHPW+7U0G3dQSzH8YpFMxaVSQ@mail.gmail.com>
	<CAMiEbchMwYJE7ShZw2YhSWV2MQ4mPA7Npti9Q2PiADhx8wCNkQ@mail.gmail.com>
	<CA+nXnG-_K3yLEm=daMV9fy7XNZLK8zBrMiE2UOm05vCBsBvmig@mail.gmail.com>
	<B0909057-2120-4C85-A442-0D0098DD4ACE@yahoo.com>
	<CA+nXnG-N2Fz3TUsxa485RL6n78L4aPWr4=HOnav0MR8EowErZQ@mail.gmail.com>
	<50776FB4.5090701@ringerc.id.au>
	<k58djk$4m3$1@ger.gmane.org>
	<5077C103.4040701@ringerc.id.au>
	<DBAC0636-546F-4864-9E01-E21D25050C71@gmail.com>

On 10/12/2012 04:39 PM, Luis Flores wrote:
> I agree, my only doubt is about the reasons behind the change, the driver was reporting int4, int8, and then was changed, why?

Yep, that I'd like to know. The change appears to be:

commit ddf8296bead68552a8e5de0f5bb20875273bb02d
Author: Kris Jurka <books@ejurka.com>
Date:   Thu Sep 30 07:58:11 2004 +0000

     Return serial datatypes in both getTypeInfo and getColumns methods.

     Jaroslaw J. Pysnzy

     Also add a test case for this and fix my previous regression test
     breakage on 7.2 servers.  With serial columns before dependency
     information dropping a table did not drop the sequences that went
     with it.  Explicitly drop them.

     Kris Jurka



see git diff 
ddf8296bead68552a8e5de0f5bb20875273bb02d..8c9d68ee7763851732de0bd0d14b2b51cdfe0622


That code is all kinds of wrong. Check this out:

if ( defval != null ) {
      if ( pgType.equals("int4") ) {
          if (defval.indexOf("nextval(") != -1)
               tuple[5] = connection.encodeString("serial");
      }
      else if ( pgType.equals("int8") ) {
          if (defval.indexOf("nextval(") != -1)
               tuple[5] = connection.encodeString("bigserial");
      }
}



*any* int4 or int8 with a DEFAULT nextval(... is reported as "serial" or 
"bigserial" whether or not it is. See AbstractJdbc2DatabaseMetaData.java 
line 2480.

--
Craig Ringer




view thread (30+ messages)  latest in thread

Message-ID: <5077EBAD.5060708@ringerc.id.au>
Permalink:  ../5077EBAD.5060708@ringerc.id.au/
Also on:    postgresql.org/message-id/5077EBAD.5060708@ringerc.id.au

 · 

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: ringerc@ringerc.id.au, luiscamposflores@gmail.com, spam_eater@gmx.net
  Subject: Re: bug report: slow getColumnTypeName
  In-Reply-To: <5077EBAD.5060708@ringerc.id.au>
  References: <CAMiEbch4MsNhkTamK3dt4GpJ8qU0BObYPmMNGkrzVFLjwONMpQ@mail.gmail.com> <CAMiEbchygfLbpytyOdDXL3-ORjMD76u_0MqwX9QROzCkHUUp0Q@mail.gmail.com> <50745541.8060204@ttc-cmc.net> <CA+nXnG8thQTe6D-njQYqQUd-LuXD2--RBejCz6Oq7dtMUEEs=g@mail.gmail.com> <CA+nXnG-xy8GvVj1gH0f0evuL0uvyw9f87zQVks_zzyuY7ZJEFA@mail.gmail.com> <CA+nXnG_Ma7c2kjsQJPDQMwXtsJHPW+7U0G3dQSzH8YpFMxaVSQ@mail.gmail.com> <CAMiEbchMwYJE7ShZw2YhSWV2MQ4mPA7Npti9Q2PiADhx8wCNkQ@mail.gmail.com> <CA+nXnG-_K3yLEm=daMV9fy7XNZLK8zBrMiE2UOm05vCBsBvmig@mail.gmail.com> <B0909057-2120-4C85-A442-0D0098DD4ACE@yahoo.com> <CA+nXnG-N2Fz3TUsxa485RL6n78L4aPWr4=HOnav0MR8EowErZQ@mail.gmail.com> <50776FB4.5090701@ringerc.id.au> <k58djk$4m3$1@ger.gmane.org> <5077C103.4040701@ringerc.id.au> <DBAC0636-546F-4864-9E01-E21D25050C71@gmail.com> <5077EBAD.5060708@ringerc.id.au>

* 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