Re: ALTER SEQUENCE ... RESTART WITH [variable] problem

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Tomi NA <hefest(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: ALTER SEQUENCE ... RESTART WITH [variable] problem
Date: 2006-05-22 22:12:40
Message-ID: 20060522221239.GB64371@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, May 20, 2006 at 11:46:25AM +0200, Tomi NA wrote:
> On 5/20/06, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
>
> >Seems you can't use a variable there. Your choices are to build a
> >string and use EXECUTE, or just do:
> >
> >SELECT setval('sequence',value);
>
> The EXECUTE string solution did the job. Thank you very much, Martijn.

As an FYI, the function version would be faster, since it can cache the
plan. Though in this case it sounds like it doesn't matter one iota.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Florian G. Pflug 2006-05-22 22:13:21 Re: Let's make CPgAN!
Previous Message Jim C. Nasby 2006-05-22 22:07:48 Re: background writer process (PID 1400) exited with exit code 0 -- repeatedly && incomplete startup packet