I want to to know if these two are functionally equivalent.  Is this:

Create table "users"
(
        "userid" BigSerial NOT NULL,
        "name" Varchar(20),
 primary key ("userid")
) Without Oids;
Create table "sales"
(
        "saleid" BigSerial NOT NULL,
        "userid" Bigint NOT NULL,
        "parent_saleid" Bigint NOT NULL,
 primary key ("saleid")
) Without Oids;
Alter table "sales" add  foreign key ("userid") references
"users" ("userid") on update restrict on delete restrict;
Alter table "sales" add  foreign key ("parent_saleid") references
"sales" ("saleid") on update restrict on delete restrict;

Is the above functionally identical to:

Create table "users"
(
        "userid" BigSerial NOT NULL,
        "name" Varchar(20),
 primary key ("userid")
) Without Oids;
Create table "sales"
(
        "saleid" BigSerial NOT NULL,
        "userid" bigint references users(userid),
        "parent_saleid" bigint references sales(saleid),
 primary key ("saleid")
) Without Oids;

Using postgreSQL 8.1 if it matters, thanks.


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to