Make length(char(n)) return 'true' length
От | Gavin Sherry |
---|---|
Тема | Make length(char(n)) return 'true' length |
Дата | |
Msg-id | Pine.LNX.4.58.0401271806250.22203@linuxworld.com.au обсуждение исходный текст |
Ответы |
Re: Make length(char(n)) return 'true' length
Re: Make length(char(n)) return 'true' length Re: Make length(char(n)) return 'true' length |
Список | pgsql-hackers |
The attached patch changes the existing behaviour of length(char(n)). Currently, this is what happens: template1=# select length('blah'::char(10));length -------- 10 (1 row) With this patch: template1=# select length('blah'::char(10));length -------- 4 (1 row) This behaviour was proposed by Tom back in November last year. (I have tried to handle multibyte correctly but probably haven't -- hence my email hackers instead of patches). The spec doesn't give us any insight (as far as I can tell) as to how we should do it length(char(n)), but the above seems consistent with other parts of the code (eg, comparison functions, concatenation). SQL200X has these choice paragraphs for those who are interested: <length expression> returns the length of a given character string, as an exact numeric value, in charactersor octets according to the choice of function. And: the result is the number of explicit or implicit <char length units> in <char length expression>, countedin accordance with the definition of those units in the relevant normatively referenced document. I have no idea what the 'normatively referenced document' is, but grep-ing through all of SQL200X, 99 and 92 didn't reveal anything too interesting. Gavin
В списке pgsql-hackers по дате отправления: