Fix some corner cases that cube_in rejects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Fix some corner cases that cube_in rejects
Date: 2016-08-29 18:19:42
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

In bug #14300 it's pointed out that cube_in rejects zero-element
cubes, as well as infinity and NaN coordinate values. Since it's
easy to make such cube values via the cube-from-float-array
constructors, this is a dump/reload hazard. The attached proposed
patch attempts to fix it up.

To deal with the infinity/NaN issues, I made cube_in and cube_out rely
on float8in_internal and float8out_internal, as we recently did for the
core geometric types. That causes the response to "1e-700" to be an
out-of-range error rather than silent underflow, which seems to me to
be fine, especially since it removes the platform dependency that's
responsible for needing the separate cube_1.out and cube_3.out files.

I also took the opportunity to make cube_in's error strings and ERRCODE
results match project convention. This is maybe a bit more debatable,
but I think it's worth doing as long as we're touching the function's

I found only one other place that seemed to be assuming that cubes
aren't zero-length, but it would be worth someone reviewing it again
to see if I missed anything. I'll put this on the commitfest queue.

regards, tom lane

Attachment Content-Type Size
fix-cube-for-empty-inf-and-nan-1.patch text/x-diff 121.2 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-08-29 18:27:17 Re: OpenSSL 1.1 breaks configure and more
Previous Message Bruce Momjian 2016-08-29 17:47:07 Re: Renaming of pg_xlog and pg_clog