Re: [COMMITTERS] pgsql: Centralize definition of integer limits.

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, pgsql-hackers(at)postgreSQL(dot)org, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Subject: Re: [COMMITTERS] pgsql: Centralize definition of integer limits.
Date: 2015-03-31 16:15:48
Message-ID: 20150331161548.GN4878@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2015-03-31 12:10:48 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2015-03-30 21:50:09 +0200, Andres Freund wrote:
> >> I'm too fried from the redeye back from pgconf nyc to do anything
> >> complicated, but it seems quite possible to define int64/uint64 based
> >> the stdint.h types if available. And generally a good idea too. I guess
> >> I'll try that tomorrow; unless Andrew beats me to it.
>
> > It's possible to do that, but it's not as trivial as I'd hoped. For one
> > we'd need to include stdint.h in some places we don't today
> > (postgres_ext.h), for another we'd need some uglyness to determine the
> > correct printf modifier for int64_t (can't use PRId64 etc afaics).
>
> Yeah, I thought the printf strings would be the sticking point :-(

I hacked things till it worked, but it seems fragile. Using Werror for
the format string test and adding 'l' to the tested combination works,
but... At the point where it basically worked the required changes
already amounted to ~150 lines changed (excluding configure). Making
that robust is more than I'm willing to do right now.

I do think it'd generally not be a bad thing to base our types on the
standard types if available.

> > I'm tempted to just prefix our limits with PG_ and define them
> > unconditionally, including appropriate casts to our types.
>
> I don't have a better idea.

Will push that.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2015-03-31 17:11:12 pgsql: Make pg_ctl use SIGINT as a default shutdown signal.
Previous Message Tom Lane 2015-03-31 16:10:48 Re: [COMMITTERS] pgsql: Centralize definition of integer limits.

Browse pgsql-hackers by date

  From Date Subject
Next Message Thom Brown 2015-03-31 16:25:48 Re: printing table in asciidoc with psql
Previous Message Tom Lane 2015-03-31 16:10:48 Re: [COMMITTERS] pgsql: Centralize definition of integer limits.