Re: getTypeMap() returns null - bug?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: javadesigner <javadesigner(at)yahoo(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: getTypeMap() returns null - bug?
Date: 2020-05-11 07:20:18
Message-ID: CAKFQuwa=3G5eZu=OpEsrwtW6EwJj3bVHW=wLuP90LvnFEo-HnQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sunday, May 10, 2020, javadesigner <javadesigner(at)yahoo(dot)com> wrote:

> Hi all:
>
> I'm playing around with customized Type Mappings and have the following
> snipped of code:
>
> ====
> Connection con = getConnection(); /*get connection from driver - util
> method*/
> System.out.println("GOT CONNECTION:" + con);
> java.util.Map map = con.getTypeMap();
> System.out.println("map:"+map);
> ====
>
> When I run this I get:
>
> GOT CONNECTION:org(dot)postgresql(dot)jdbc(dot)PgConnection(at)3f8f9dd6
> map:null
>
> getTypeMap should return a map but it returns null !

While I agree, the feature is effectively not supported.

https://github.com/pgjdbc/pgjdbc/blob/14576f4bca3a2484fd4f81a0d8276ae5cab9a419/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java#L604

I can’t see changing it to throw a runtime exception and returning an empty
map doesn’t make it any more usable so I don’t see the point there either.
The documentation could better reflect reality though.

David J.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mark Rotteveel 2020-05-11 07:44:09 Re: getTypeMap() returns null - bug?
Previous Message javadesigner 2020-05-11 06:28:16 Re: getTypeMap() returns null - bug?