Re: [GENERAL] Is there any different for foreign key to be serial instead of integer

2010-01-06 Thread Richard Broersma
On Wed, Jan 6, 2010 at 8:36 PM, Scott Marlowe wrote: >.  A >> serial foreign key would be nonsensical since foreign keys should be >> be generating their own values. > > Pretty sure the OP was talking about referencing a bigserial from a > foreign key, which makes perfect sense for certain types o

Re: [GENERAL] Is there any different for foreign key to be serial instead of integer

2010-01-06 Thread Scott Marlowe
On Wed, Jan 6, 2010 at 9:08 PM, Richard Broersma wrote: > On Wed, Jan 6, 2010 at 7:51 PM, Yan Cheng Cheok wrote: > > >> instead of let customer_id being type as integer, can i let it be serial? is >> there any difference? >> >> if the table referenced by customer_id is having primary key typed b

Re: [GENERAL] Is there any different for foreign key to be serial instead of integer

2010-01-06 Thread Richard Broersma
On Wed, Jan 6, 2010 at 7:51 PM, Yan Cheng Cheok wrote: > instead of let customer_id being type as integer, can i let it be serial? is > there any difference? > > if the table referenced by customer_id is having primary key typed big > serial, customer_id shall be declared as bigint ? This is

Re: [GENERAL] Is there any different for foreign key to be serial instead of integer

2010-01-06 Thread Scott Marlowe
On Wed, Jan 6, 2010 at 8:51 PM, Yan Cheng Cheok wrote: > I came across a lot of similar example for foreign key > > CREATE TABLE orderinfo > ( > orderinfo_id serial , > customer_id integer NOT NULL, > date_placed date NOT NULL, > date_shipped date , > shipping numeric(7,2) , > CONSTRAINT orderinfo

[GENERAL] Is there any different for foreign key to be serial instead of integer

2010-01-06 Thread Yan Cheng Cheok
I came across a lot of similar example for foreign key CREATE TABLE orderinfo ( orderinfo_id serial , customer_id integer NOT NULL, date_placed date NOT NULL, date_shipped date , shipping numeric(7,2) , CONSTRAINT orderinfo_pk PRIMARY KEY(orderinfo_id), CONSTRAINT orderinfo_customer_id_fk FOREIGN