pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: chris+postgresql@qwirx.com
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Why can NUMERIC columns not use deduplication?
Date: Fri, 14 Jan 2022 10:14:41 -0500
Message-ID: <3379157.1642173281@sss.pgh.pa.us> (raw)
In-Reply-To: <164216867903.23277.10737033258186320533@wrigleys.postgresql.org>
References: <164216867903.23277.10737033258186320533@wrigleys.postgresql.org>

PG Doc comments form <noreply@postgresql.org> writes:
> "64.4.3. Deduplication" says:
> "numeric cannot use deduplication. Numeric display scale must be preserved
> among equal datums."

> However I don't understand this. An equal datum is an equal datum regardless
> of display scale, isn't it?

No.  For example:

regression=# select 1.0, 1.00;
 ?column? | ?column? 
----------+----------
      1.0 |     1.00
(1 row)

regression=# select 1.0 = 1.00;
 ?column? 
----------
 t
(1 row)

These values are "equal" per the datatype's equality operator,
but there are some operations (not only output) that can distinguish
them, so the index can't lump them together.

There are similar issues in some other datatypes, for example
zero and minus zero in the float types.

			regards, tom lane





view thread (2+ messages)

Message-ID: <3379157.1642173281@sss.pgh.pa.us>
Permalink:  ../3379157.1642173281@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3379157.1642173281@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, chris+postgresql@qwirx.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Why can NUMERIC columns not use deduplication?
  In-Reply-To: <3379157.1642173281@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox