Re: Changing ids conflicting with serial values?

From: Alex Turner <armtuk(at)gmail(dot)com>
To: Marc Boucher <achernar(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Changing ids conflicting with serial values?
Date: 2005-11-04 16:49:53
Message-ID: 33c6269f0511040849o35afebd8ja63b76946bd4e266@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 <achernar(at)gmx(dot)net> wrote:
> 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 will fail all new inserts.
>
>
> ---------------------------(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
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-11-04 16:53:22 Re: Bug in Role support?
Previous Message Florian G. Pflug 2005-11-04 16:26:42 Bug in Role support?