Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject
| От | Thomas Hallgren |
|---|---|
| Тема | Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject |
| Дата | |
| Msg-id | 44A1739A.2080102@tada.se обсуждение исходный текст |
| Ответ на | Re: [Fwd: Re: [Pljava-dev] char with trailing space, (Kris Jurka <books@ejurka.com>) |
| Ответы |
Re: [Fwd: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject
|
| Список | pgsql-jdbc |
Kris Jurka wrote:
>
> The JDBC driver does not trim spaces. What it does is pass
> setString() values with a type of varchar, perhaps pljava is using
> text and exposing this subtle difference:
>
> # select 'a '::char(2) = 'a '::text;
> ?column?
> ----------
> f
> (1 row)
> # select 'a '::char(2) = 'a '::varchar;
> ?column?
> ----------
> t
> (1 row)
>
I'm missing something. Both text and varchar consider the space significant:
thhal=# select length(' '::char);
length
--------
0
(1 row)
thhal=# select length(' '::varchar);
length
--------
1
(1 row)
thhal=# select length(' '::text);
length
--------
1
(1 row)
so why does it make a difference to use varchar instead of text? I.e.
why are your comparison results different? Why is the space
insignificant when using char?
Regards,
Thomas Hallgren
В списке pgsql-jdbc по дате отправления: