Skip site navigation (1) Skip section navigation (2)

Re: Using nulls with earthdistance operator crashes backend (patch)

From: Mark Stosberg <mark(at)summersault(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Using nulls with earthdistance operator crashes backend (patch)
Date: 2001-08-16 22:12:16
Message-ID: 3B7C452A.4C3F2051@summersault.com (view raw or flat)
Thread:
Lists: pgsql-bugs
> Tom Lane wrote:
> >
> > Mark Stosberg <mark(at)summersault(dot)com> writes:
> > > * Install earthdistance operator from the contrib directory.
> > > * try this:
> > > cascade=> select null <@> '1,1'::point;
> >
> > > ## The result I get:
> > > pqReadData() -- backend closed the channel unexpectedly.
> >
> > Probably the earthdistance functions are not NULL-safe and need to be
> > marked "isStrict" in CREATE FUNCTION.  Would you be willing to do the
> > legwork on working up a patch for that?

Tom,

Here's a patch using "isstrict":

############
--- earthdistance.sql.in.org    Thu Aug 16 17:08:19 2001
+++ earthdistance.sql.in        Thu Aug 16 17:09:01 2001
@@ -3,7 +3,8 @@

 DROP FUNCTION geo_distance (point, point);
 CREATE FUNCTION geo_distance (point, point) RETURNS float8
-  AS 'MODULE_PATHNAME' LANGUAGE 'c';
+  AS 'MODULE_PATHNAME' LANGUAGE 'c'
+  WITH (isstrict);

 SELECT geo_distance ('(1,2)'::point, '(3,4)'::point);
#############

Now when I run the "crasher" SQL above, I get one empty row back:

sumsault_test=# select null <@> '1,1'::point;
 ?column?
----------

(1 row)
#############

I look forward to seeing you at the Open Source Database Summit!

  -mark

 . . . . . . . . . . . . . . . . . . . . . . . . . .
   Mark Stosberg              Principal Developer  
   mark(at)summersault(dot)com       Summersault, LLC     
   v: 765-939-9301 ext 223    website development  
 . . . . . http://www.summersault.com/ . . . . . . .

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-08-16 22:22:07
Subject: Re: Using nulls with earthdistance operator crashes backend (patch)
Previous:From: Tom LaneDate: 2001-08-16 19:58:08
Subject: Re: inherited tables failure

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group