dbTalk Databases Forums  

Re: [BUGS] distance operator dont work

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] distance operator dont work in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] distance operator dont work - 08-13-2006 , 10:44 AM






On Sat, Aug 12, 2006 at 08:52:48AM +0200, bernard snyers wrote:
Quote:
I have a table containing polygon and I try a distance operator which
fails. (select * from mytable order by point(10,10) <-> mycol)

Postgres responds that the operator <-> between a point and a polygon is
unknown.

I look in the pg_operator.h (in src/include/catalog) where I think all
builtin operators are defined and found these definitions
Are you aware that you can query the system catalogs with SQL instead
of digging into header files? See also psql's \do command.

http://www.postgresql.org/docs/8.1/i.../catalogs.html
http://www.postgresql.org/docs/8.1/i...-operator.html
http://www.postgresql.org/docs/8.1/i.../app-psql.html

Quote:
and there is none between a point and a polygon. (600 604) (furthermore
the 628 type is defined in ptypes.h as not implemented.

I did the following test,
I patch the line
DATA(insert OID = 613 ( "<->" PGNSP PGUID b f 600 628 701
0 0 0 0 0 0 dist_pl - - ));

replacing 628 by 604 ,
compiling and reinstalling everything including the database
The dist_pl function expects a line argument; calling it with a
different type could cause unexpected results or even a server
crash. And are you aware that you can use CREATE OPERATOR instead
of hacking the source code and recompiling?

http://www.postgresql.org/docs/8.1/i...eoperator.html

Quote:
and It works (I didnt verify the result)
In what sense does it work if you didn't verify the result?

Quote:
So I am wondering , if I miss something, do I have to convert my point
in a degenerated circle or polygon) or do you forget one definition ?
I'd guess that certain features remain unimplemented due to lack
of interest; maybe one of the developers can comment on the history
of support for geometry operations. A nice thing about PostgreSQL
is that it's extensible without having to hack the source code: you
can write your own functions in PL/pgSQL or C or some other language
and create operators that call those functions. Such customizations
survive migrations via database dumps so you don't have to remember
to patch the code every time you upgrade.

If you're working with spatial data then you might want to check
out PostGIS:

http://www.postgis.org/

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] distance operator dont work - 08-13-2006 , 12:09 PM






bernard snyers <bs (AT) ionicsoft (DOT) com> writes:
Quote:
I patch the line
DATA(insert OID = 613 ( "<->" PGNSP PGUID b f 600 628 701
0 0 0 0 0 0 dist_pl - - ));

replacing 628 by 604 ,
compiling and reinstalling everything including the database
and It works (I didnt verify the result)
Obviously not. line and polygon don't have the same internal
representation, so there's no way that's going to work.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.