pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Define integer limits independently from the system definitions.
2+ messages / 2 participants
[nested] [flat]
* pgsql: Define integer limits independently from the system definitions.
@ 2015-04-02 15:45 Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 2+ messages in thread
From: Andres Freund @ 2015-04-02 15:45 UTC (permalink / raw)
To: pgsql-committers
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.GK4878@alap3.anarazel.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(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [COMMITTERS] pgsql: Define integer limits independently from the system definitions.
@ 2015-10-19 14:51 Michael Paquier <michael.paquier@gmail.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 2+ messages in thread
From: Michael Paquier @ 2015-10-19 14:51 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Hi Andres,
On Fri, Apr 3, 2015 at 12:45 AM, Andres Freund <andres@anarazel.de> wrote:
> 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.
>
This commit has added PG_INT16_MIN/MAX, however we still rely on SHRT_MIN
and SHRT_MAX in some code paths. On all the platforms I looked at (OpenBSD,
FreeBSD, MinGW, MSVC, OSX, Linux, Solaris) SHRT_MIN and SHRT_MAX
definitions are always the same. Still, shouldn't we replace SHRT_* by
their equivalent PG_INT16_* to be completely independent? I am just
wondering if you considered that.
Regards,
--
Michael
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2015-10-19 14:51 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02 15:45 pgsql: Define integer limits independently from the system definitions. Andres Freund <andres@anarazel.de>
2015-10-19 14:51 ` Michael Paquier <michael.paquier@gmail.com>
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