Having contributed to the need for pg_dump/initdb/restore when
upgrading from 7.2 to 7.3, I plan to submit a patch which *could* make
future transitions easier.

bufpage.h:

typedef struct PageHeaderData
{
...
        uint32          pd_type;                /* kind and version */
...
}

#define PKIND_HEAP 0x36ae
#define PKIND_BTREEMETA 0x696e
#define PKIND_BTREEINT 0x7552
#define PKIND_BTREELEAF 0x0c9c
#define PKIND_HASH 0xce79
#define PKIND_SEQUENCE 0xd863
#define PKIND_GISTINT 0x5b52
#define PKIND_GISTLEAF 0xde08
#define PKIND_RTREEINT 0x6d17
#define PKIND_RTREELEAF 0x239e

#define PageSetType(page, kind, major, minor) \
        (((PageHeader) (page))->pd_type = \
         (((kind) << 16) | ((major) << 12) | ((minor) << 8)) \
        )

#define PageSetTypeCurrent (page, kind) PageSetType(page, kind, 7, 3)

#define PageGetKind(page) \
        ((((PageHeader) (page))->pd_type & 0xffff0000) >> 16)

#define PageGetFormat(page) \
        ((((PageHeader) (page))->pd_type & 0x0000ff00) >> 8)

#define PageGetFormatMinor(page) \
        ((((PageHeader) (page))->pd_type & 0x00000f00) >> 8)

#define PageGetFormatMajor(page) \
        ((((PageHeader) (page))->pd_type & 0x0000f000) >> 12)

With most page types this looks like a waste of space (0,05%), which I
hope can be compensated for by greater flexibility in future Postgres
versions.  With rtree and gist pd_type replaces a flags field in
OpaqueData (not yet sure about this; will investigate further).

Note, that this or any other kind of version information has to be
implemented at least one release *before* it can be used for the first
time.

Comments?  Any chance for this to go into 7.3?

Servus
 Manfred

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to