From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Ken Camann <kjcamann(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Summary of some postgres portability issues |
Date: | 2008-07-09 20:45:53 |
Message-ID: | 20080709204553.GE18930@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 09, 2008 at 03:03:48PM -0400, Ken Camann wrote:
> On Wed, Jul 9, 2008 at 3:35 AM, Martijn van Oosterhout
> <kleptog(at)svana(dot)org> wrote:
>
> > Just clarifying for myself: you are mostly listing theoretical problems
> > here, not actual "I ran it and got regression failures" problems, right?
>
> Correct. This is why most of them point out that they are not
> actually real problems, just written in a less than ideal way.
> I'd fix them, but would anyone be willing to commit that?
Probably, as long as the proposed fix don't break any other already
supported platform.
> I know that a Datum cannot be bigger than 1 GB either way, but the
> documentation around the Datum typedef notes that Datum must large
> enough to hold a pointer. It does not say why, or where this
> assumption gets used, or why it was made.
Firstly, I'd suggest checking out the docs on CREATE TYPE, to see the
possibilities:
http://www.postgresql.org/docs/8.2/static/sql-createtype.html
Basically, a Datum can represent any type you can see from SQL. It must
be big enough to hold a pointer because in most cases, it *is* a
pointer. There's essentially three possibilities:
- Small integral type: eg: float/int4/int2/bool, these are simply
stored as the Datum itself.
- Fixed width type: eg: point/complex, here the Datum is a pointer to
the data
- Variable length type: text/varchar, here the Datum is a pointer to a
header which describes the actual length.
The actual assumptions are listed somewhere in the header defining
Datum.
> As for what would replace it, I think intptr_t. This type has the
> same size as long on LP32, ILP32, LP64, and ILP64 so there would be no
> changes to anything that already works, plus this type can hold a
> pointer on LLP64 compilers.
Does this type exist on all the other systems? Not everywhere is C99
unfortunatly.
> > I don't understand what you mean here: the Datum type has very clear
> > rules about how it is stored. It is essentially opaque, but given the
> > typlen you have enough information to know how to copy it for example.
>
> Well, that is some good news. Where can I find these rules?
I think I explained it enough above, if you have any more questions,
just ask.
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2008-07-09 20:50:44 | Re: PATCH: CITEXT 2.0 v3 |
Previous Message | Aidan Van Dyk | 2008-07-09 20:43:27 | Re: [PATCHES] WITH RECURSIVE updated to CVS TIP |