Re: [GENERAL] Primary Key with serial the solution?

2008-04-01 Thread x asasaxax
How about if i do this inside a procedure: SELECT setval('sequence',(SELECT max(id) FROM table)) INTO variable; insert into table values(variable, ..., ...); ? Will this be transactional? Cause, they say that setval is a command that its transactional. Using this way i donĀ“t will need to use a

Re: [GENERAL] Primary Key with serial the solution?

2008-04-01 Thread Craig Ringer
x asasaxax wrote: How about if i do this inside a procedure: SELECT setval('sequence',(SELECT max(id) FROM table)) INTO variable; insert into table values(variable, ..., ...); ? Will this be transactional? Cause, they say that setval is a command that its transactional. Using this way i

Re: [GENERAL] Primary Key with serial

2008-03-31 Thread x asasaxax
can anyone do a example for me.. an explain how it works? Thanks a lot 2008/3/29, Berend Tober [EMAIL PROTECTED]: x asasaxax wrote: I have the following tablecreate table product(cod serial, user_cod bigint, constraint product_fk Foreign Key(user_cod) references user(cod),

Re: [GENERAL] Primary Key with serial

2008-03-29 Thread Berend Tober
x asasaxax wrote: I have the following tablecreate table product(cod serial, user_cod bigint, constraint product_fk Foreign Key(user_cod) references user(cod), constraint product_pk Primary Key(cod, user_cod)); What i want to happend is that: user_codcod 1

[GENERAL] Primary Key with serial

2008-03-28 Thread x asasaxax
Hi, I have the following tablecreate table product(cod serial, user_cod bigint, constraint product_fk Foreign Key(user_cod) references user(cod), constraint product_pk Primary Key(cod, user_cod)); What i want to happend is that: user_codcod 1 1 1

Re: [GENERAL] Primary Key with serial

2008-03-28 Thread brian
x asasaxax wrote: Hi, I have the following tablecreate table product(cod serial, user_cod bigint, constraint product_fk Foreign Key(user_cod) references user(cod), constraint product_pk Primary Key(cod, user_cod)); What i want to happend is that: user_codcod 1