Currently 64 bit ints are used for the serial types used for
mailbox_idnr and message_idnr, and those are used for IMAP's
UIDVALIDITY and UID.

But IMAP specified that those two values are 32 bit ints.

Given that pgsql does not have a uint32_t, and defaults to int64_t
for serial columns, changing the _idnr to INT4 is of course wrong.

But should the MAXVAL be specified when creating the sequence?

Ie, 

Index: sql/postgresql/create_tables.pgsql
===================================================================
--- sql/postgresql/create_tables.pgsql  (revision 2601)
+++ sql/postgresql/create_tables.pgsql  (working copy)
@@ -58,7 +58,7 @@
 );
 CREATE UNIQUE INDEX usermap_idx_1 ON dbmail_usermap(login, sock_allow, userid);
 
-CREATE SEQUENCE dbmail_mailbox_idnr_seq;
+CREATE SEQUENCE dbmail_mailbox_idnr_seq MAXVALUE pow(2,32)-1;
 CREATE TABLE dbmail_mailboxes (
    mailbox_idnr INT8 DEFAULT nextval('dbmail_mailbox_idnr_seq'),
    owner_idnr INT8 REFERENCES dbmail_users(user_idnr) ON DELETE CASCADE ON 
UPDATE CASCADE,
@@ -111,7 +111,7 @@
    PRIMARY KEY(id)
 );
 
-CREATE SEQUENCE dbmail_message_idnr_seq;
+CREATE SEQUENCE dbmail_message_idnr_seq MAXVALUE pow(2,32)-1;
 CREATE TABLE dbmail_messages (
    message_idnr INT8 DEFAULT nextval('dbmail_message_idnr_seq'),
    mailbox_idnr INT8 REFERENCES dbmail_mailboxes(mailbox_idnr)


and probably something similar for my and lite?

Alternatively, of course, the front ends can do something if they find
that the value is (or is to be) greater than ~(uint32_t)0.  But a SQL-
level contstraint seems like the right model.

-JimC
-- 
James Cloos <[EMAIL PROTECTED]>         OpenPGP: 1024D/ED7DAEA6
_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to