[PATCH] Revive line type - Mailing list pgsql-hackers

From rui hua
Subject [PATCH] Revive line type
Date
Msg-id CAHfbbWvgj-VfqW00uSKFW=r6KbvMhfaH71OQRmmU0c+2YFtQ8Q@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] Revive line type
List pgsql-hackers

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

pgsql-hackers by date:

Previous
From: "MauMau"
Date:
Subject: Re: backend hangs at immediate shutdown (Re: Back-branch update releases coming in a couple weeks)
Next
From: "MauMau"
Date:
Subject: Re: backend hangs at immediate shutdown (Re: Back-branch update releases coming in a couple weeks)