Re: behaviour of LENGTH() in postgresql v. 8
От | Tom Lane |
---|---|
Тема | Re: behaviour of LENGTH() in postgresql v. 8 |
Дата | |
Msg-id | 29795.1099089110@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | behaviour of LENGTH() in postgresql v. 8 ("Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br>) |
Ответы |
Re: behaviour of LENGTH() in postgresql v. 8
|
Список | pgsql-novice |
"Marcus Andree S. Magalhaes" <marcus.magalhaes@vlinfo.com.br> writes: > If I understand correctly, this will lead to the following situation: > CHAR_LENGTH('ABCD') == CHAR_LENGTH('ABCD ') == 4 > This will definitely break some of our applications. If you think trailing spaces are semantically significant, you should be using varchar or text fields to store them. In CHAR(n) fields they are not significant, and we're doing our best to make that interpretation consistent across all operations. Just for the record, I get this with CVS tip: regression=# select CHAR_LENGTH('ABCD '); char_length ------------- 8 (1 row) regression=# select CHAR_LENGTH('ABCD '::text); char_length ------------- 8 (1 row) regression=# select CHAR_LENGTH('ABCD '::varchar); char_length ------------- 8 (1 row) regression=# select CHAR_LENGTH('ABCD '::char(8)); char_length ------------- 4 (1 row) (the first and second cases are in fact the same) regards, tom lane
В списке pgsql-novice по дате отправления: