Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 189699d

Browse files
committed
Remove unimplemented/undocumented geometric functions & operators.
Nobody has filled in these stubs for upwards of twenty years, so it's time to drop the idea that they might get implemented any day now. The associated pg_operator and pg_proc entries are just confusing wastes of space. Per complaint from Anton Voloshin. Discussion: https://postgr.es/m/3426566.1638832718@sss.pgh.pa.us
1 parent 922b23c commit 189699d

File tree

7 files changed

+1
-175
lines changed

7 files changed

+1
-175
lines changed

src/backend/utils/adt/geo_ops.c

-110
Original file line numberDiff line numberDiff line change
@@ -2532,44 +2532,6 @@ dist_bs(PG_FUNCTION_ARGS)
25322532
PG_RETURN_FLOAT8(box_closept_lseg(NULL, box, lseg));
25332533
}
25342534

2535-
/*
2536-
* Distance from a line to a box
2537-
*/
2538-
Datum
2539-
dist_lb(PG_FUNCTION_ARGS)
2540-
{
2541-
#ifdef NOT_USED
2542-
LINE *line = PG_GETARG_LINE_P(0);
2543-
BOX *box = PG_GETARG_BOX_P(1);
2544-
#endif
2545-
2546-
/* need to think about this one for a while */
2547-
ereport(ERROR,
2548-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2549-
errmsg("function \"dist_lb\" not implemented")));
2550-
2551-
PG_RETURN_NULL();
2552-
}
2553-
2554-
/*
2555-
* Distance from a box to a line
2556-
*/
2557-
Datum
2558-
dist_bl(PG_FUNCTION_ARGS)
2559-
{
2560-
#ifdef NOT_USED
2561-
BOX *box = PG_GETARG_BOX_P(0);
2562-
LINE *line = PG_GETARG_LINE_P(1);
2563-
#endif
2564-
2565-
/* need to think about this one for a while */
2566-
ereport(ERROR,
2567-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2568-
errmsg("function \"dist_bl\" not implemented")));
2569-
2570-
PG_RETURN_NULL();
2571-
}
2572-
25732535
static float8
25742536
dist_cpoly_internal(CIRCLE *circle, POLYGON *poly)
25752537
{
@@ -2947,48 +2909,6 @@ close_pb(PG_FUNCTION_ARGS)
29472909
PG_RETURN_POINT_P(result);
29482910
}
29492911

2950-
2951-
/* close_sl()
2952-
* Closest point on line to line segment.
2953-
*
2954-
* XXX THIS CODE IS WRONG
2955-
* The code is actually calculating the point on the line segment
2956-
* which is backwards from the routine naming convention.
2957-
* Copied code to new routine close_ls() but haven't fixed this one yet.
2958-
* - thomas 1998-01-31
2959-
*/
2960-
Datum
2961-
close_sl(PG_FUNCTION_ARGS)
2962-
{
2963-
#ifdef NOT_USED
2964-
LSEG *lseg = PG_GETARG_LSEG_P(0);
2965-
LINE *line = PG_GETARG_LINE_P(1);
2966-
Point *result;
2967-
float8 d1,
2968-
d2;
2969-
2970-
result = (Point *) palloc(sizeof(Point));
2971-
2972-
if (lseg_interpt_line(result, lseg, line))
2973-
PG_RETURN_POINT_P(result);
2974-
2975-
d1 = line_closept_point(NULL, line, &lseg->p[0]);
2976-
d2 = line_closept_point(NULL, line, &lseg->p[1]);
2977-
if (float8_lt(d1, d2))
2978-
*result = lseg->p[0];
2979-
else
2980-
*result = lseg->p[1];
2981-
2982-
PG_RETURN_POINT_P(result);
2983-
#endif
2984-
2985-
ereport(ERROR,
2986-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2987-
errmsg("function \"close_sl\" not implemented")));
2988-
2989-
PG_RETURN_NULL();
2990-
}
2991-
29922912
/*
29932913
* Closest point on line segment to line.
29942914
*
@@ -3120,22 +3040,6 @@ close_sb(PG_FUNCTION_ARGS)
31203040
}
31213041

31223042

3123-
Datum
3124-
close_lb(PG_FUNCTION_ARGS)
3125-
{
3126-
#ifdef NOT_USED
3127-
LINE *line = PG_GETARG_LINE_P(0);
3128-
BOX *box = PG_GETARG_BOX_P(1);
3129-
#endif
3130-
3131-
/* think about this one for a while */
3132-
ereport(ERROR,
3133-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3134-
errmsg("function \"close_lb\" not implemented")));
3135-
3136-
PG_RETURN_NULL();
3137-
}
3138-
31393043
/*---------------------------------------------------------------------
31403044
* on_
31413045
* Whether one object lies completely within another.
@@ -4503,20 +4407,6 @@ path_div_pt(PG_FUNCTION_ARGS)
45034407
}
45044408

45054409

4506-
Datum
4507-
path_center(PG_FUNCTION_ARGS)
4508-
{
4509-
#ifdef NOT_USED
4510-
PATH *path = PG_GETARG_PATH_P(0);
4511-
#endif
4512-
4513-
ereport(ERROR,
4514-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4515-
errmsg("function \"path_center\" not implemented")));
4516-
4517-
PG_RETURN_NULL();
4518-
}
4519-
45204410
Datum
45214411
path_poly(PG_FUNCTION_ARGS)
45224412
{

src/include/catalog/catversion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 202112111
56+
#define CATALOG_VERSION_NO 202112131
5757

5858
#endif

src/include/catalog/pg_cast.dat

-2
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,6 @@
381381
castcontext => 'a', castmethod => 'f' },
382382
{ castsource => 'lseg', casttarget => 'point', castfunc => 'point(lseg)',
383383
castcontext => 'e', castmethod => 'f' },
384-
{ castsource => 'path', casttarget => 'point', castfunc => 'point(path)',
385-
castcontext => 'e', castmethod => 'f' },
386384
{ castsource => 'path', casttarget => 'polygon', castfunc => 'polygon(path)',
387385
castcontext => 'a', castmethod => 'f' },
388386
{ castsource => 'box', casttarget => 'point', castfunc => 'point(box)',

src/include/catalog/pg_operator.dat

-17
Original file line numberDiff line numberDiff line change
@@ -1177,9 +1177,6 @@
11771177
{ oid => '969', descr => 'center of',
11781178
oprname => '@@', oprkind => 'l', oprleft => '0', oprright => 'lseg',
11791179
oprresult => 'point', oprcode => 'lseg_center' },
1180-
{ oid => '970', descr => 'center of',
1181-
oprname => '@@', oprkind => 'l', oprleft => '0', oprright => 'path',
1182-
oprresult => 'point', oprcode => 'path_center' },
11831180
{ oid => '971', descr => 'center of',
11841181
oprname => '@@', oprkind => 'l', oprleft => '0', oprright => 'polygon',
11851182
oprresult => 'point', oprcode => 'poly_center' },
@@ -1742,14 +1739,6 @@
17421739
oprresult => 'float8', oprcom => '<->(circle,polygon)',
17431740
oprcode => 'dist_polyc' },
17441741

1745-
# additional geometric operators - thomas 1997-07-09
1746-
{ oid => '1524', descr => 'distance between',
1747-
oprname => '<->', oprleft => 'line', oprright => 'box', oprresult => 'float8',
1748-
oprcom => '<->(box,line)', oprcode => 'dist_lb' },
1749-
{ oid => '1382', descr => 'distance between',
1750-
oprname => '<->', oprleft => 'box', oprright => 'line', oprresult => 'float8',
1751-
oprcom => '<->(line,box)', oprcode => 'dist_bl' },
1752-
17531742
{ oid => '1525', descr => 'intersect',
17541743
oprname => '?#', oprleft => 'lseg', oprright => 'lseg', oprresult => 'bool',
17551744
oprcom => '?#(lseg,lseg)', oprcode => 'lseg_intersect' },
@@ -1805,15 +1794,9 @@
18051794
oprname => '##', oprleft => 'point', oprright => 'box', oprresult => 'point',
18061795
oprcode => 'close_pb' },
18071796

1808-
{ oid => '1566', descr => 'closest point to A on B',
1809-
oprname => '##', oprleft => 'lseg', oprright => 'line', oprresult => 'point',
1810-
oprcode => 'close_sl' },
18111797
{ oid => '1567', descr => 'closest point to A on B',
18121798
oprname => '##', oprleft => 'lseg', oprright => 'box', oprresult => 'point',
18131799
oprcode => 'close_sb' },
1814-
{ oid => '1568', descr => 'closest point to A on B',
1815-
oprname => '##', oprleft => 'line', oprright => 'box', oprresult => 'point',
1816-
oprcode => 'close_lb' },
18171800
{ oid => '1577', descr => 'closest point to A on B',
18181801
oprname => '##', oprleft => 'line', oprright => 'lseg', oprresult => 'point',
18191802
oprcode => 'close_ls' },

src/include/catalog/pg_proc.dat

-18
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,6 @@
658658
{ oid => '225',
659659
proname => 'lseg_center', prorettype => 'point', proargtypes => 'lseg',
660660
prosrc => 'lseg_center' },
661-
{ oid => '226',
662-
proname => 'path_center', prorettype => 'point', proargtypes => 'path',
663-
prosrc => 'path_center' },
664661
{ oid => '227',
665662
proname => 'poly_center', prorettype => 'point', proargtypes => 'polygon',
666663
prosrc => 'poly_center' },
@@ -1460,12 +1457,6 @@
14601457
{ oid => '702',
14611458
proname => 'dist_lp', prorettype => 'float8', proargtypes => 'line point',
14621459
prosrc => 'dist_lp' },
1463-
{ oid => '726',
1464-
proname => 'dist_lb', prorettype => 'float8', proargtypes => 'line box',
1465-
prosrc => 'dist_lb' },
1466-
{ oid => '703',
1467-
proname => 'dist_bl', prorettype => 'float8', proargtypes => 'box line',
1468-
prosrc => 'dist_bl' },
14691460
{ oid => '727',
14701461
proname => 'dist_sl', prorettype => 'float8', proargtypes => 'lseg line',
14711462
prosrc => 'dist_sl' },
@@ -1970,12 +1961,6 @@
19701961
{ oid => '961',
19711962
proname => 'close_pl', prorettype => 'point', proargtypes => 'point line',
19721963
prosrc => 'close_pl' },
1973-
{ oid => '962',
1974-
proname => 'close_sl', prorettype => 'point', proargtypes => 'lseg line',
1975-
prosrc => 'close_sl' },
1976-
{ oid => '963',
1977-
proname => 'close_lb', prorettype => 'point', proargtypes => 'line box',
1978-
prosrc => 'close_lb' },
19791964

19801965
{ oid => '964', descr => 'large object unlink (delete)',
19811966
proname => 'lo_unlink', provolatile => 'v', proparallel => 'u',
@@ -3213,9 +3198,6 @@
32133198
{ oid => '1532', descr => 'center of',
32143199
proname => 'point', prorettype => 'point', proargtypes => 'lseg',
32153200
prosrc => 'lseg_center' },
3216-
{ oid => '1533', descr => 'center of',
3217-
proname => 'point', prorettype => 'point', proargtypes => 'path',
3218-
prosrc => 'path_center' },
32193201
{ oid => '1534', descr => 'center of',
32203202
proname => 'point', prorettype => 'point', proargtypes => 'box',
32213203
prosrc => 'box_center' },

src/test/regress/expected/geometry.out

-14
Original file line numberDiff line numberDiff line change
@@ -1467,11 +1467,6 @@ SELECT l1.s, l2.s, l1.s <-> l2.s FROM LINE_TBL l1, LINE_TBL l2;
14671467
{-1,0,3} | {-1,0,3} | 0
14681468
(100 rows)
14691469

1470-
-- Distance to box
1471-
SELECT l.s, b.f1, l.s <-> b.f1 FROM LINE_TBL l, BOX_TBL b;
1472-
ERROR: function "dist_lb" not implemented
1473-
SELECT l.s, b.f1, b.f1 <-> l.s FROM LINE_TBL l, BOX_TBL b;
1474-
ERROR: function "dist_bl" not implemented
14751470
-- Intersect with line
14761471
SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?# l2.s;
14771472
s | s
@@ -1773,9 +1768,6 @@ SELECT l.s, l1.s, l.s ## l1.s FROM LINE_TBL l, LSEG_TBL l1;
17731768
{-1,0,3} | [(NaN,1),(NaN,90)] |
17741769
(80 rows)
17751770

1776-
-- Closest point to box
1777-
SELECT l.s, b.f1, l.s ## b.f1 FROM LINE_TBL l, BOX_TBL b;
1778-
ERROR: function "close_lb" not implemented
17791771
--
17801772
-- Line segments
17811773
--
@@ -2376,9 +2368,6 @@ SELECT l1.s, l2.s, l1.s # l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
23762368
[(NaN,1),(NaN,90)] | [(NaN,1),(NaN,90)] |
23772369
(64 rows)
23782370

2379-
-- Closest point to line
2380-
SELECT l.s, l1.s, l.s ## l1.s FROM LSEG_TBL l, LINE_TBL l1;
2381-
ERROR: function "close_sl" not implemented
23822371
-- Closest point to line segment
23832372
SELECT l1.s, l2.s, l1.s ## l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
23842373
s | s | ?column?
@@ -2922,9 +2911,6 @@ SELECT f1, @-@ f1 FROM PATH_TBL;
29222911
((11,12),(13,14)) | 5.65685424949
29232912
(9 rows)
29242913

2925-
-- Center
2926-
SELECT f1, @@ f1 FROM PATH_TBL;
2927-
ERROR: function "path_center" not implemented
29282914
-- To polygon
29292915
SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1);
29302916
f1 | f1

src/test/regress/sql/geometry.sql

-13
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?-| l2.s;
129129
-- Distance to line
130130
SELECT l1.s, l2.s, l1.s <-> l2.s FROM LINE_TBL l1, LINE_TBL l2;
131131

132-
-- Distance to box
133-
SELECT l.s, b.f1, l.s <-> b.f1 FROM LINE_TBL l, BOX_TBL b;
134-
SELECT l.s, b.f1, b.f1 <-> l.s FROM LINE_TBL l, BOX_TBL b;
135-
136132
-- Intersect with line
137133
SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?# l2.s;
138134

@@ -145,9 +141,6 @@ SELECT l1.s, l2.s, l1.s # l2.s FROM LINE_TBL l1, LINE_TBL l2;
145141
-- Closest point to line segment
146142
SELECT l.s, l1.s, l.s ## l1.s FROM LINE_TBL l, LSEG_TBL l1;
147143

148-
-- Closest point to box
149-
SELECT l.s, b.f1, l.s ## b.f1 FROM LINE_TBL l, BOX_TBL b;
150-
151144
--
152145
-- Line segments
153146
--
@@ -213,9 +206,6 @@ SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
213206
-- Intersection point with line segment
214207
SELECT l1.s, l2.s, l1.s # l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
215208

216-
-- Closest point to line
217-
SELECT l.s, l1.s, l.s ## l1.s FROM LSEG_TBL l, LINE_TBL l1;
218-
219209
-- Closest point to line segment
220210
SELECT l1.s, l2.s, l1.s ## l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
221211

@@ -285,9 +275,6 @@ SELECT f1, area(f1) FROM PATH_TBL;
285275
-- Length
286276
SELECT f1, @-@ f1 FROM PATH_TBL;
287277

288-
-- Center
289-
SELECT f1, @@ f1 FROM PATH_TBL;
290-
291278
-- To polygon
292279
SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1);
293280

0 commit comments

Comments
 (0)