Search Postgresql Archives

Are these two creation commands functionally identical?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux