pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
NULL values in arrays
3+ messages / 2 participants
[nested] [flat]

* NULL values in arrays
@ 2007-11-20 18:57 Christian Schröder <cs@deriva.de>
  2007-11-20 21:37 ` Re: NULL values in arrays Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Christian Schröder @ 2007-11-20 18:57 UTC (permalink / raw)
  To: pgsql-jdbc

Hi list,
since PostgreSQL version 8.2 arrays can contain null values. This 
doesn't seem to be correctly handled by the driver. (I had a look at the 
latest CVS version.)
I have found in the archive a mail from Marek Lewczuk (sent on 
2007-10-11) who adressed this issue, but the thread seems to be dead. 
Moreover, he did not supply a patch, so I tried to do it myself. Could 
you please have a look at the attached file and decide if it should be 
applied to the sources?

Thanks a lot!
    Christian

-- 
Deriva GmbH                         Tel.: +49 551 489500-42
Financial IT and Consulting         Fax:  +49 551 489500-91
Hans-Böckler-Straße 2                  http://www.deriva.de
D-37079 Göttingen

Deriva CA Certificate: http://www.deriva.de/deriva-ca.cer

Attachments:

AbstractJdbc2Array.java.patch (text/plain, 1.9K) download Index: AbstractJdbc2Array.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Array.java,v retrieving revision 1.19 diff -c -r1.19 AbstractJdbc2Array.java *** AbstractJdbc2Array.java 10 Sep 2007 08:34:31 -0000 1.19 --- AbstractJdbc2Array.java 20 Nov 2007 18:29:45 -0000 *************** *** 103,108 **** --- 103,110 ---- StringBuffer sbuf = new StringBuffer(); boolean foundOpen = false; boolean insideString = false; + boolean isQuoted = false; + boolean haveMinServerVersion82 = conn.haveMinimumServerVersion("8.2"); /** * Starting with 8.0 non-standard (beginning index *************** *** 142,147 **** --- 144,150 ---- else if (chars[i] == '"') { insideString = !insideString; + isQuoted = true; continue; } else if (!insideString && (chars[i] == ',' || chars[i] == '}') || *************** *** 149,156 **** { if ( chars[i] != '"' && chars[i] != '}' && chars[i] != ',' ) sbuf.append(chars[i]); ! array.add( sbuf.toString() ); sbuf = new StringBuffer(); continue; } sbuf.append( chars[i] ); --- 152,160 ---- { if ( chars[i] != '"' && chars[i] != '}' && chars[i] != ',' ) sbuf.append(chars[i]); ! array.add( sbuf.toString().equals("NULL") && !isQuoted && haveMinServerVersion82 ? null : sbuf.toString() ); sbuf = new StringBuffer(); + isQuoted = false; continue; } sbuf.append( chars[i] );
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: NULL values in arrays
  2007-11-20 18:57 NULL values in arrays Christian Schröder <cs@deriva.de>
@ 2007-11-20 21:37 ` Kris Jurka <books@ejurka.com>
  2007-11-21 19:50   ` Re: NULL values in arrays Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Kris Jurka @ 2007-11-20 21:37 UTC (permalink / raw)
  To: Christian Schröder <cs@deriva.de>; +Cc: pgsql-jdbc



On Tue, 20 Nov 2007, Christian Schröder wrote:

> since PostgreSQL version 8.2 arrays can contain null values. This doesn't 
> seem to be correctly handled by the driver. (I had a look at the latest CVS 
> version.)
> I have found in the archive a mail from Marek Lewczuk (sent on 2007-10-11) 
> who adressed this issue, but the thread seems to be dead. Moreover, he did 
> not supply a patch, so I tried to do it myself. Could you please have a look 
> at the attached file and decide if it should be applied to the sources?
>

Marek did post a patch that additionally contains support for 
multi-dimensional indexes which has complicated the reviewing process. 
I'll post my comments on that patch tomorrow and we'll hopefully get it 
into the 8.3 release.  For the 8.2 driver I'll take a closer look at your 
patch and apply it barring some unforeseen issue.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: NULL values in arrays
  2007-11-20 18:57 NULL values in arrays Christian Schröder <cs@deriva.de>
  2007-11-20 21:37 ` Re: NULL values in arrays Kris Jurka <books@ejurka.com>
@ 2007-11-21 19:50   ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Kris Jurka @ 2007-11-21 19:50 UTC (permalink / raw)
  To: Christian Schröder <cs@deriva.de>; +Cc: pgsql-jdbc



On Tue, 20 Nov 2007, Kris Jurka wrote:

> On Tue, 20 Nov 2007, Christian Schröder wrote:
>
>> since PostgreSQL version 8.2 arrays can contain null values. This doesn't 
>> seem to be correctly handled by the driver. (I had a look at the latest CVS 
>> version.)
>
> Marek did post a patch that additionally contains support for 
> multi-dimensional indexes which has complicated the reviewing process. I'll 
> post my comments on that patch tomorrow and we'll hopefully get it into the 
> 8.3 release.  For the 8.2 driver I'll take a closer look at your patch and 
> apply it barring some unforeseen issue.
>

I've applied your patch to the 8.2 branch while we wait to see what will 
be done for 8.3.

Kris Jurka


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-11-21 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-11-20 18:57 NULL values in arrays Christian Schröder <cs@deriva.de>
2007-11-20 21:37 ` Kris Jurka <books@ejurka.com>
2007-11-21 19:50   ` Kris Jurka <books@ejurka.com>

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