Re: int8 sequences --- small implementation problem

From: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
To: "Jan Wieck" <JanWieck(at)yahoo(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: int8 sequences --- small implementation problem
Date: 2001-08-14 15:36:43
Message-ID: 009201c124d6$ed27bbd0$48d210ac@jecw2k1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> typedef struct FormData_pg_sequence
> {
> NameData sequence_name;
> int32 last_value;
> int32 increment_by;
> int32 max_value;
> int32 min_value;
> int32 cache_value;
> int32 log_cnt;
> char is_cycled;
> char is_called;
> } FormData_pg_sequence;
>
> If I just change "int32" to "int64" here, all is well on machines where
> sizeof(int64) is 8. But if there's no 64-bit C datatype, int64 is
> typedef'd as "long int", so sizeof(int64) is only 4. Result: the struct
> declaration won't agree with the heaptuple layout --- since the tuple
> routines will believe that the datatype of these columns has size 8.
>
> What I need is a way to pad the struct declaration so that it leaves
> 8 bytes per int64 column, no matter what. I thought of
>

What if you defined int64 as a union made up of one "long int" member and
one 8 byte char member, and then always refer to the "long int"?

-- Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-08-14 15:46:39 Re: To be 7.1.3 or not to be 7.1.3?
Previous Message Tom Lane 2001-08-14 15:28:28 Re: int8 sequences --- small implementation problem