width_bucket() for float8

From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: width_bucket() for float8
Date: 2007-01-12 02:11:32
Message-ID: 1168567892.5462.38.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Attached is a patch that provides an implementation of width_bucket()
for the float8 data type, per earlier discussion. The implementation is
fairly ugly, but I don't see an easy way to simplify it.

When writing this, I noticed that my previous implementation of
width_bucket() probably 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(). I think this is reasonable
behavior -- any objections?

float8 also allows positive and negative infinity. I disallowed infinite
values for the histogram bounds, but allowed it for the operand.

-Neil

Attachment Content-Type Size
width_bucket_f8-1.patch text/x-patch 11.9 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Joshua D. Drake 2007-01-12 02:35:39 Re: [PATCHES] Tablespace for temporary objects and
Previous Message Jaime Casanova 2007-01-12 02:05:58 Re: [PATCHES] Tablespace for temporary objects and sort files