Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3 - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3
Date
Msg-id CAKFQuwaoeuEAuzXCYTozmzRuOaF0aFTywh7D14-vWyPMGKsdvQ@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Function with limit and offset - PostgreSQL 9.3  (marcinha rocha <marciaestefanidarocha@hotmail.com>)
List pgsql-general
On Thursday, June 8, 2017, marcinha rocha <marciaestefanidarocha@hotmail.com> wrote:

When I call the function, it must execute 2000 rows and then stop. Then when calling it again, it must start from 2001 to 4000, and so on

You can do this is with plain sql with the help of a CTE.  Insert into + Select ... limit 2000 returning id.  Migration done.  Put that in a CTE.  In the outer query perform the update by referencing the returned rows from the CTE.

David J.

pgsql-general by date:

Previous
From: marcinha rocha
Date:
Subject: [GENERAL] Function with limit and offset - PostgreSQL 9.3
Next
From: John R Pierce
Date:
Subject: Re: [GENERAL] Function with limit and offset - PostgreSQL 9.3