Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-07 Thread Scott Marlowe
On Fri, 2005-11-04 at 15:49, Marc Boucher wrote: > At 11:49 04/11/2005 -0500, Alex Turner wrote: > > I think he meant > > > > create sequence test_seq; > > select setval('test_seq',(select max(primary_key_id) from my_table)); > > > > not max value of a serial type. > > What I understand, and from

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-04 Thread Marc Boucher
At 11:49 04/11/2005 -0500, Alex Turner wrote: > I think he meant > > create sequence test_seq; > select setval('test_seq',(select max(primary_key_id) from my_table)); > > not max value of a serial type. What I understand, and from what I know by using mysql, is that mysql auto-adjust the max value

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-04 Thread Jerry Sievers
Steven Brown <[EMAIL PROTECTED]> writes: > I'm granting access to insert/update/delete rows of a table to people, > but I don't want all future inserts to fail if they decided to change an > id (which they obviously shouldn't, but they /can/). It makes for a > fragile system. create rule no_p

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-04 Thread Alex Turner
I think he meant create sequence test_seq; select setval('test_seq',(select max(primary_key_id) from my_table)); not max value of a serial type. Alex On 11/3/05, Marc Boucher <[EMAIL PROTECTED]> wrote: > On Wed, 02 Nov 2005 19:29:10 -0800, you wrote: > > >It's a migration thing - MySQL prevente

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-03 Thread MaXX
Steven Brown wrote: > When I change an id (primary key serial) in a table, the next value > returned by the sequence for the id can conflict with that id (e.g., > change the id to be id + 1). [...] If you're doing this to have a custom ordering of your data, consider adding another int column wit

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-03 Thread Marc Boucher
On Wed, 02 Nov 2005 19:29:10 -0800, you wrote: >It's a migration thing - MySQL prevented this >situation due to the way it handles auto_increment (it will never assign >you an id that already exists). AFAIK, in mysql, if you modify a serial by setting it to the max value for this type, mysql wi

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-03 Thread Csaba Nagy
[snip] On Thu, 2005-11-03 at 18:02, [EMAIL PROTECTED] wrote: > Strange - I had never realized that PostgreSQL would allow you to UPDATE a > primary key value. I thought that other db's I had used (e.g. Sybase, > Oracle, SQL Server, etc.) in the past would not allow that, and you had to > DELETE, t

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-03 Thread SCassidy
MAIL PROTECTED]> Sent by: cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Changing ids conflicting w

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-02 Thread Douglas McNaught
Steven Brown <[EMAIL PROTECTED]> writes: > I'm granting access to insert/update/delete rows of a table to people, > but I don't want all future inserts to fail if they decided to change > an id (which they obviously shouldn't, but they /can/). It makes for > a fragile system. If it shouldn't hap

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-02 Thread Joshua D. Drake
Steven Brown wrote: When I change an id (primary key serial) in a table, the next value returned by the sequence for the id can conflict with that id (e.g., change the id to be id + 1). MySQL seems to handle this transparently by skipping conflicting values, but with PostgreSQL I get primary

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-02 Thread Steven Brown
Tom Lane wrote: Steven Brown <[EMAIL PROTECTED]> writes: When I change an id (primary key serial) in a table, the next value returned by the sequence for the id can conflict with that id (e.g., change the id to be id + 1). [...] Plan A: don't do that. Why in the world is it a good idea to mo

Re: [GENERAL] Changing ids conflicting with serial values?

2005-11-02 Thread Tom Lane
Steven Brown <[EMAIL PROTECTED]> writes: > When I change an id (primary key serial) in a table, the next value > returned by the sequence for the id can conflict with that id (e.g., > change the id to be id + 1). MySQL seems to handle this transparently > by skipping conflicting values, but wit

[GENERAL] Changing ids conflicting with serial values?

2005-11-02 Thread Steven Brown
When I change an id (primary key serial) in a table, the next value returned by the sequence for the id can conflict with that id (e.g., change the id to be id + 1). MySQL seems to handle this transparently by skipping conflicting values, but with PostgreSQL I get primary key conflicts. It se