[PATCH] Revive line type

From: rui hua <365507506hua(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: pgsql-rrreviewers(at)postgresql(dot)org
Subject: [PATCH] Revive line type
Date: 2013-06-23 04:24:23
Message-ID: CAHfbbWvgj-VfqW00uSKFW=r6KbvMhfaH71OQRmmU0c+2YFtQ8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-rrreviewers

Hi,

Test results are as follows:

Contents & Purpose

This patch is for finishing the line type and related functions that not
done yet but listed in catalogs and documentation. There are no other new
features added in this patch.

The regression test cases which included in this patch, Documentation are
also updated.

Run

Regression tests are all succeed, but several problems have be found while
ding some simple test. The updated document said that the points used in
the output are not necessarily the points used on input. I understand that
as long as they are marked on the same line. But when the input data
represents a horizontal or vertical line, the output is not exactly the
same line. It is another line parallel to it.

For example:

postgres=# select line('1,3,2,3');

line

-----------------

[(0,-3),(1,-3)]

(1 row)

postgres=# select line('1,3,1,6');

line

-----------------

[(-1,0),(-1,1)]

(1 row)

In addition, when a straight line coincides with coordinate axis, output
appears -0, I do not know whether it is appropriate.

postgres=# select line('0,1,0,5');

line

-----------------

[(-0,0),(-0,1)]

(1 row)

Negative value appeared when use <-> to calculate the distance between two
parallel lines.

postgres=# select line('1,1,2,1') <-> line('-1,-1,-2,-1') ;

?column?

----------

-2

postgres=# select lseg('1,1,2,1') <-> line('-1,-1,-2,-1') ;

?column?

----------

-2

(1 row)

The same situation occurs in distance calculation between point and a
straight line.

postgres=# select point('-1,1') <-> line('-3,0,-4,0') ;

?column?

----------

-1

(1 row)

Should the distance be positive numbers?

Other functions seem work properly.

Performance

==================================

Because these functions is first implemented. So there is no relatively
comparison for the performance.

Conclusion

This patch lets line type worked. But there are some bugs. Additionally,
function "close_sl" not implemented.

With Regards,

Rui

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message MauMau 2013-06-23 04:55:19 Re: backend hangs at immediate shutdown (Re: Back-branch update releases coming in a couple weeks)
Previous Message MauMau 2013-06-23 03:46:59 Re: backend hangs at immediate shutdown (Re: Back-branch update releases coming in a couple weeks)

Browse pgsql-rrreviewers by date

  From Date Subject
Next Message Ian Lawrence Barwick 2013-06-24 15:28:46 A would-be reviewer writes...
Previous Message Magnus Hagander 2013-06-20 09:44:07 Re: [pgsql-www] problem with logging into commitfest site