pgsql: Implement width_bucket() for the float8 data type.

From: neilc(at)postgresql(dot)org (Neil Conway)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Implement width_bucket() for the float8 data type.
Date: 2007-01-16 21:41:14
Message-ID: 20070116214114.68E7F9FB319@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Implement width_bucket() for the float8 data type.

The implementation is somewhat ugly logic-wise, but I don't see an
easy way to make it more concise.

When writing this, I noticed that my previous implementation of
width_bucket() doesn't handle NaN correctly:

postgres=# select width_bucket('NaN', 1, 5, 5);
width_bucket
--------------
6
(1 row)

AFAICS SQL:2003 does not define a NaN value, so it doesn't address how
width_bucket() should behave here. The patch changes width_bucket() so
that ereport(ERROR) is raised if NaN is specified for the operand or the
lower or upper bounds to width_bucket(). For float8, NaN is disallowed
for any of the floating-point inputs, and +/- infinity is disallowed
for the histogram bounds (but allowed for the operand).

Update docs and regression tests, bump the catversion.

Modified Files:
--------------
pgsql/doc/src/sgml:
func.sgml (r1.350 -> r1.351)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml.diff?r1=1.350&r2=1.351)
pgsql/src/backend/utils/adt:
float.c (r1.146 -> r1.147)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/float.c.diff?r1=1.146&r2=1.147)
numeric.c (r1.98 -> r1.99)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/numeric.c.diff?r1=1.98&r2=1.99)
pgsql/src/include/catalog:
catversion.h (r1.371 -> r1.372)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h.diff?r1=1.371&r2=1.372)
pg_proc.h (r1.436 -> r1.437)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h.diff?r1=1.436&r2=1.437)
pgsql/src/include/utils:
builtins.h (r1.285 -> r1.286)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/builtins.h.diff?r1=1.285&r2=1.286)
pgsql/src/test/regress/expected:
numeric.out (r1.19 -> r1.20)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/numeric.out.diff?r1=1.19&r2=1.20)
pgsql/src/test/regress/sql:
numeric.sql (r1.12 -> r1.13)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/numeric.sql.diff?r1=1.12&r2=1.13)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Neil Conway 2007-01-16 21:43:19 pgsql: vcbuild updates from Magnus: * After Markos patch, now builds
Previous Message Neil Conway 2007-01-16 20:58:38 pgsql: Minor improvements to the TODO list.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-01-17 00:18:14 Re: Idea for fixing the Windows fsync problem
Previous Message jhaile 2007-01-16 20:51:06 Re: PostgreSQL win32 fragmentation issue