Re: BUG #2240: length() with geometric types

Поиск
Список
Период
Сортировка
От James William Pye
Тема Re: BUG #2240: length() with geometric types
Дата
Msg-id 20060207012251.GA26495@lit.jwp.name
обсуждение исходный текст
Ответ на BUG #2240: length() with geometric types  ("Andreas Erber" <post@andreas-erber.net>)
Ответы Re: BUG #2240: length() with geometric types  (Andreas Erber <post@andreas-erber.net>)
Список pgsql-bugs
On Mon, Feb 06, 2006 at 02:41:39PM +0000, Andreas Erber wrote:
> Hi,
>
> I discovered some strange behaviour:
> The length() function returns different results depending on the geometric
> data type used as argument.
>
> length(lseg) produces the correct result, i.e. length(lseg('(0,0),(2,0)')) =
> 2
>
> length(path) always produces the double result (independently from the
> length of the path), i.e.
> length(path('(0,0),(2,0)')) = 4
> length(path('(0,0),(2,0),(4,0),(6,0),(8,0)')) = 16
>
> Is it supposed to be that way? If yes, why?

Yes.

You specified your path as a closed path. With its "loopback", it's twice as
long.

To specify it as an open path, do path('[(0,0),(2,0)]').

SELECT length(path('[(1,0),(0,0)]')) = '1';
SELECT length(path('(1,0),(0,0)')) = '2';
--
Regards, James William Pye

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: SELECT max() won't use a NOT NULL index
Следующее
От: Olleg Samoylov
Дата:
Сообщение: Re: BUG #2239: "vacuumdb -a" remove freeze