Thread: pgsql: Provide separate header file for built-in float types

pgsql: Provide separate header file for built-in float types

From
Tomas Vondra
Date:
Provide separate header file for built-in float types

Some data types under adt/ have separate header files, but most simple
ones do not, and their public functions are defined in builtins.h.  As
the patches improving geometric types will require making additional
functions public, this seems like a good opportunity to create a header
for floats types.

Commit 1acf757255 made _cmp functions public to solve NaN issues locally
for GiST indexes.  This patch reworks it in favour of a more widely
applicable API.  The API uses inline functions, as they are easier to
use compared to macros, and avoid double-evaluation hazards.

Author: Emre Hasegeli
Reviewed-by: Kyotaro Horiguchi

Discussion:
https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6bf0bc842bd75877e31727eb559c6a69e237f831

Modified Files
--------------
contrib/btree_gin/btree_gin.c                 |   1 +
contrib/btree_gist/btree_ts.c                 |   1 +
contrib/cube/cube.c                           |   2 +-
contrib/cube/cubeparse.y                      |   2 +-
contrib/postgres_fdw/postgres_fdw.c           |   1 +
src/backend/access/gist/gistget.c             |   2 +-
src/backend/access/gist/gistproc.c            |  56 ++-
src/backend/access/gist/gistutil.c            |   2 +-
src/backend/utils/adt/float.c                 | 589 ++++++--------------------
src/backend/utils/adt/formatting.c            |   1 +
src/backend/utils/adt/geo_ops.c               |   7 +-
src/backend/utils/adt/geo_spgist.c            |   3 +-
src/backend/utils/adt/numeric.c               |   1 +
src/backend/utils/adt/rangetypes_gist.c       |   3 +-
src/backend/utils/adt/rangetypes_selfuncs.c   |   3 +-
src/backend/utils/adt/rangetypes_typanalyze.c |   3 +-
src/backend/utils/adt/timestamp.c             |   1 +
src/backend/utils/misc/guc.c                  |   1 +
src/include/utils/builtins.h                  |  14 -
src/include/utils/float.h                     | 376 ++++++++++++++++
20 files changed, 556 insertions(+), 513 deletions(-)


Re: pgsql: Provide separate header file for built-in float types

From
Dean Rasheed
Date:
On 29 July 2018 at 02:43, Tomas Vondra <tomas.vondra@postgresql.org> wrote:
> Provide separate header file for built-in float types

It looks like this commit broke float8_accum() and float4_accum() when
not invoked as aggregates (transdatums is no longer being populated).

Possibly it would be worth having regression tests for those, to be safe.

Regards,
Dean