Missing SIZE_MAX

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Date: 2017-09-01T15:09:55Z
Lists: pgsql-hackers
Commit 2e70d6b5e added a dependency on SIZE_MAX to libpq/fe_exec.c.
According to C99 and recent POSIX, that symbol should be provided
by <stdint.h>, but SUS v2 (POSIX 2001) doesn't require <stdint.h>
to exist at all ... and I now notice that gaur/pademelon doesn't
have it, and unsurprisingly is failing to compile fe_exec.c.

We have a workaround for that symbol in timezone/private.h:

#ifndef SIZE_MAX
#define SIZE_MAX ((size_t) -1)
#endif

and a bit of grepping finds other places that are using the (size_t) -1
trick explicitly.  So what I'm tempted to do is move the above stanza
into c.h.  Any objections?

			regards, tom lane


Commits

  1. Make [U]INT64CONST safe for use in #if conditions.

  2. Ensure SIZE_MAX can be used throughout our code.

  3. Teach libpq to detect integer overflow in the row count of a PGresult.