Re: updating a sequence
От | Samuel Gendler |
---|---|
Тема | Re: updating a sequence |
Дата | |
Msg-id | CAEV0TzApAcAtTZYqHGGexBfvps__v9oTwEQ5dGrtEqHPEYeW3w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: updating a sequence (John Fabiani <johnf@jfcomputer.com>) |
Ответы |
Re: updating a sequence
|
Список | pgsql-sql |
On Tue, Nov 15, 2011 at 4:28 PM, John Fabiani <johnf@jfcomputer.com> wrote:
On Tuesday, November 15, 2011 08:33:54 am Richard Broersma wrote:I don't see how that helps answer my problem. I know how to update a
> On Tue, Nov 15, 2011 at 8:06 AM, John Fabiani <johnf@jfcomputer.com> wrote:
> > alter sequence somename restart with (select max(pk) from sometable).
> >
> > I need this for automating an ETL (using pentaho).
>
> http://www.postgresql.org/docs/9.1/interactive/functions-sequence.html#FUNC
> TIONS-SEQUENCE-TABLE
sequence. I want to pass a value for the restart vaue that depends on a query
- all in one statement. I would think it is a common problem i.e. migrating
data.
use a subquery to set the value -
select setval('foo', select max(some_id) from some_table)
It's all right there in the docs that you were pointed to. We try to encourage people to be somewhat self sufficient around here.
В списке pgsql-sql по дате отправления: