pgsql: Define integer limits independently from the system definitions.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Define integer limits independently from the system definitions.
Date: 2015-04-02 15:45:56
Message-ID: E1YdhJc-0000XL-7G@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Define integer limits independently from the system definitions.

In 83ff1618 we defined integer limits iff they're not provided by the
system. That turns out not to be the greatest idea because there's
different ways some datatypes can be represented. E.g. on OSX PG's 64bit
datatype will be a 'long int', but OSX unconditionally uses 'long
long'. That disparity then can lead to warnings, e.g. around printf
formats.

One way to fix that would be to back int64 using stdint.h's
int64_t. While a good idea it's not that easy to implement. We would
e.g. need to include stdint.h in our external headers, which we don't
today. Also computing the correct int64 printf formats in that case is
nontrivial.

Instead simply prefix the integer limits with PG_ and define them
unconditionally. I've adjusted all the references to them in code, but
not the ones in comments; the latter seems unnecessary to me.

Discussion: 20150331141423(dot)GK4878(at)alap3(dot)anarazel(dot)de

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/62e2a8dc2c7f6b1351a0385491933af969ed4265

Modified Files
--------------
contrib/btree_gist/btree_ts.c | 4 +-
contrib/pgbench/pgbench.c | 8 ++--
src/backend/access/transam/xlog.c | 2 +-
src/backend/tsearch/wparser_def.c | 2 +-
src/backend/utils/adt/int8.c | 2 +-
src/backend/utils/adt/numutils.c | 2 +-
src/backend/utils/adt/timestamp.c | 2 +-
src/backend/utils/adt/txid.c | 2 +-
src/include/c.h | 68 ++++++++++-------------------
src/include/datatype/timestamp.h | 4 +-
src/include/executor/instrument.h | 2 +-
src/include/nodes/parsenodes.h | 2 +-
src/include/pg_config_manual.h | 4 +-
src/include/port/atomics.h | 4 +-
src/include/storage/predicate_internals.h | 2 +-
src/include/utils/date.h | 4 +-
16 files changed, 45 insertions(+), 69 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2015-04-02 15:54:20 Re: [COMMITTERS] pgsql: Centralize definition of integer limits.
Previous Message Alvaro Herrera 2015-04-02 15:36:12 pgsql: psql: fix \connect with URIs and conninfo strings

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2015-04-02 15:50:26 Re: Tables cannot have INSTEAD OF triggers
Previous Message Abhijit Menon-Sen 2015-04-02 15:27:24 Re: What exactly is our CRC algorithm?