Re: \0 and IllegalArgumentException

From: Jon Orris <jorris(at)redhat(dot)com>
To: vadimn(at)redhat(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org, sebster(at)sebster(dot)com
Subject: Re: \0 and IllegalArgumentException
Date: 2004-10-29 14:36:57
Message-ID: 1099060617.1377.3.camel@goodeats.boston.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 2004-10-29 at 10:24 -0400, Vadim Nasardinov wrote:
> | test=> select str, length(str) as length from dropme;
> | str | length
> | -------+--------
> | Hello | 5
> | (1 row)
> |
> | test=> select str, length(str) as length from dropme where str like '%world';
> | str | length
> | -------+--------
> | Hello | 5
> | (1 row)
> |
> | test=> select str, length(str) as length from dropme where str like '%Welt';
> | str | length
> | -----+--------
> | (0 rows)

> Not sure how the latest version behaves.

I get slightly different results from 7.4.5. The string is still
truncated, but the length is correct:

jorris=# select str, length(str) as length from dropme;
str | length
-------+--------
Hello | 11
(1 row)

jorris=# select str, length(str) as length from dropme where str like '%
world';
str | length
-------+--------
Hello | 11
(1 row)

jorris=# select substring(version(), 1, 20) as version;
version
----------------------
PostgreSQL 7.4.5 on
(1 row)

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2004-10-29 15:36:38 Re: \0 and IllegalArgumentException
Previous Message Vadim Nasardinov 2004-10-29 14:24:03 Re: \0 and IllegalArgumentException