1. PostgreSQL reports syntax error with precision specified integers, example: "INT(10)"
2. PostgreSQL reports syntax error with use of "unsigned" with integers.
3. No autoincrement in PostgreSQL !!!! :(
The following doesn't work:

CREATE TABLE {rsvp} (rid int(10) unsigned NOT NULL auto_increment,
                nid int(10) unsigned NOT NULL default '0',
                uid int(10) unsigned NOT NULL default '0',
                name varchar(128) default '',
                invite_text text,
                blind int(3) unsigned NOT NULL default '0',
                list_email int(3) unsigned NOT NULL default '0',
                allow_invite int(3) unsigned NOT NULL default '0',
                timestamp int(10) unsigned NOT NULL default '0',
                PRIMARY KEY (rid,uid,nid));

The following works:

CREATE TABLE rsvp (rid int NOT NULL,
                nid int NOT NULL default '0',
                uid int NOT NULL default '0',
                name varchar(128) default '',
                invite_text text,
                blind int NOT NULL default '0',
                list_email int NOT NULL default '0',
                allow_invite int NOT NULL default '0',
                timestamp int NOT NULL default '0',
                PRIMARY KEY (rid,uid,nid));

So this looks like a no-go without PostgreSQL "sequences" instructions.

Comments

havran’s picture

Note only. Autoincrement field should be serial type, it's postgresql eq. to mysql autoincrement:

CREATE TABLE rsvp (rid int serial,
nid int NOT NULL default '0',
uid int NOT NULL default '0',
name varchar(128) default '',
invite_text text,
blind int NOT NULL default '0',
list_email int NOT NULL default '0',
allow_invite int NOT NULL default '0',
timestamp int NOT NULL default '0',
PRIMARY KEY (rid,uid,nid));
wdtj’s picture

That wasn't quite right either. int should be serial, it's not a modifier. Also there is no enum.

Here's what I used and it seems to work:

      db_query("CREATE TABLE {rsvp} (rid serial,
                nid int NOT NULL default '0',
                uid int NOT NULL default '0',
                name varchar(128) default '',
                invite_text text,
                blind int NOT NULL default '0',
                list_email int NOT NULL default '0',
                allow_invite int NOT NULL default '0',
                timestamp int NOT NULL default '0',
                PRIMARY KEY (rid,uid,nid));");

      db_query("CREATE TABLE {rsvp_invite} (
                response varchar(5) NOT NULL,
                rid int NOT NULL default '0',
                uid int NOT NULL default '0',
                email varchar(128) NOT NULL default '',
                hash varchar(255) NOT NULL default '',
                invited int NOT NULL default '0',
                received int NOT NULL default '0',
                timestamp int NOT NULL default '0',
                PRIMARY KEY (rid,email,uid),
                CHECK(response IN ('yes','no','maybe','none')));");
owahab’s picture

Assigned: victorkane » owahab
Status: Active » Needs review
owahab’s picture

Status: Needs review » Reviewed & tested by the community
owahab’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)