Re: OID unsigned long long - Mailing list pgsql-hackers

From Tom Lane
Subject Re: OID unsigned long long
Date
Msg-id 14639.997756624@sss.pgh.pa.us
Whole thread Raw
In response to OID unsigned long long  (mlw <markw@mohawksoft.com>)
List pgsql-hackers
mlw <markw@mohawksoft.com> writes:
> Aside from adding %llu to all the %u everywhere an OID is used in a
> printf, and any other warnings, are there any other things I should be
> specially concerned about?

FE/BE protocol, a/k/a client/server interoperability.  Flagging a
database so that a backend with the wrong OID size won't try to run in
it.  Alignment --- on machines where long long has to be 8-byte aligned,
TOAST references as presently constituted will crash, because varlena
datatypes in general are only 4-byte aligned.  There are more, but that
will do for starters.

BTW, I think #ifdef would be a totally unworkable way to attack the
format-string problem.  The code clutter of #ifdef'ing everyplace that
presently uses %u would be a nightmare; the impact on
internationalization files would be worse.  And don't forget that %llu
would be the right thing on only some machines; others like %qu, and
DEC Alphas think %lu is just fine.  The only workable answer I can see
is for the individual messages to use some special code, maybe "%O" for
Oid.  The problem is then (a) translating this to the right
platform-dependent thing, and (b) persuading gcc to somehow type-check
the elog calls anyway.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tim Allen
Date:
Subject: Re: Vague idea for allowing per-column locale
Next
From: Tatsuo Ishii
Date:
Subject: Re: Vague idea for allowing per-column locale