[HACKERS] Problems with LSEGs
[HACKERS] Problems with LSEGs
От:
dasmith@perseus.tufts.edu (David Smith)
Дата:
============================================================================
POSTGRES BUG REPORT TEMPLATE
============================================================================
Your name : David Smith
Your email address : dasmith@perseus.tufts.edu
System Configuration
- ---------------------
Architecture (example: Intel Pentium) : DEC Alpha
Operating System (example: Linux 1.3.42 ELF) : Digital UNIX 4.0
PostgreSQL version (example: Postgres95-1.01) : PostgreSQL-6.1 (3 June)
Compiler used (example: gcc 2.7.0) : DEC C V5.2-023
Please enter a FULL description of your problem:
- ------------------------------------------------
OK. I recompiled today's distribution and simply selecting LSEGs no longer
dumps core. I am able, however, to reproduce my dist_ps problem. COntrary
to my earlier assertion, the slope of the segment does appear to be an
issue. If the point is on the segment, that too causes a problem.
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
- ----------------------------------------------------------------------
archdb=> \i segtest.sql
create table a (name text,p point);
CREATE
create table b (name text,s lseg);
CREATE
insert into a values ('point1', '(5,5)'::point );
INSERT 17662
insert into b values ('seg1', '[(1,1),(9,9)]' );
INSERT 17663
insert into b values ('seg2', '[(1,1),(9,1)]' );
INSERT 17664
insert into b values ('seg3', '[(1,1),(1,9)]' );
INSERT 17665
insert into b values ('seg4', '[(1,1),(9,5)]' );
INSERT 17666
select * from b;
name|s
- ----+-------------
seg1|[(1,1),(9,9)]
seg2|[(1,1),(9,1)]
seg3|[(1,1),(1,9)]
seg4|[(1,1),(9,5)]
(4 rows)
select dist_ps(a.p, b.s),a.p,b.s from a,b where b.name = 'seg1';
WARN:floating point exception! the last floating point operation either exceeded
legal ranges or was a divide by zero
select dist_ps(a.p, b.s),a.p,b.s from a,b where b.name = 'seg2';
WARN:floating point exception! the last floating point operation either exceeded
legal ranges or was a divide by zero
select dist_ps(a.p, b.s),a.p,b.s from a,b where b.name = 'seg3';
dist_ps|p |s
- ----------------+-----+-------------
5.65685424949238|(5,5)|[(1,1),(1,9)]
(1 row)
select dist_ps(a.p, b.s),a.p,b.s from a,b where b.name = 'seg4';
dist_ps|p |s
- ----------------+-----+-------------
2.23606797749979|(5,5)|[(1,1),(9,5)]
(1 row)
EOF
archdb=>
If you know how this problem might be fixed, list the solution below:
- ---------------------------------------------------------------------
------------------------------Re: [HACKERS] Problems with LSEGs
От:
"Thomas G. Lockhart" <Thomas.Lockhart@jpl.nasa.gov>
Дата:
David Smith wrote: > Architecture (example: Intel Pentium) : DEC Alpha > Operating System (example: Linux 1.3.42 ELF) : Digital UNIX 4.0 > PostgreSQL version (example: Postgres95-1.01) : PostgreSQL-6.1 (3 June) > Compiler used (example: gcc 2.7.0) : DEC C V5.2-023 > ... the slope of the segment does appear to be an > issue. If the point is on the segment, that too causes a problem. I can't get your test case to fail on my i686/Linux machine. I'm very familiar with Alpha boxes, and haven't noticed anything obvious in the lseg code causing a problem. The routines are in src/backend/utils/adt/geo_ops.c, and if you start putting in printf() statements to narrow down the problem we might have some luck fixing it. Another possibility is to compile with the flag "-ieee_noinexact" to suppress floating point traps on underflow and overflow, but I don't know if that will help. ------------------------------