Обсуждение: [HACKERS] close_ps, NULLs, and DirectFunctionCall
(From IRC discussion with Andreas about some sqlsmith errors) Commit 278148907a9 changed close_ps in geo_ops.c to return SQL NULL in the event that a valid result point was not found (rather than crashing or failing an assert). But close_ps is called with DirectFunctionCall from other close_* functions, and indirectly from dist_* functions. So while the specific case of (point ## lseg) returns a NULL with no error in this case, for other data types, or for certain dist_* calls, rather than a null result you get this: postgres=# select point(1,2) ## '((0,0),(NaN,NaN))'::box; ERROR: function 0x9c5de0 returned NULL postgres=# select point(1,2) <-> '((0,0),(NaN,NaN))'::box; ERROR: function 0x9c5de0 returned NULL This seems ... unhelpful (though it's at least better than crashing) and inconsistent. Does this need fixing, and if so how? The most consistent fix would seem to be to make all the affected functions return NULL, which probably requires factoring out a bunch of close_*_internal functions and replacing the DirectFunctionCall usage. -- Andrew (irc:RhodiumToad) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
> Does this need fixing, and if so how? My improve geometric types patch [1] fixes this issue, by cosidering NaNs larger than any non-NAN same as the float types. There are many issues with the geometric types similar to this. Let's combine our efforts to put them into a shape. [1] https://www.postgresql.org/message-id/flat/CAE2gYzxF7-5djV6-cEvqQu-fNsnt=EqbOURx7ZDg+Vv6ZMTWbg@mail.gmail.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
On Wed, Sep 20, 2017 at 4:25 PM, Andrew Gierth <andrew@tao11.riddles.org.uk> wrote: > postgres=# select point(1,2) ## '((0,0),(NaN,NaN))'::box; > ERROR: function 0x9c5de0 returned NULL > > postgres=# select point(1,2) <-> '((0,0),(NaN,NaN))'::box; > ERROR: function 0x9c5de0 returned NULL > > This seems ... unhelpful (though it's at least better than crashing) and > inconsistent. I'd call that a bug. > The most consistent fix would seem > to be to make all the affected functions return NULL, Based on your description of the problem I would tend to agree, although I'm not really familiar with this area. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers