On Tue, Feb 3, 2026 at 3:49 PM Shinya Kato <[email protected]> wrote:
> Hi hackers, > > I'd like to propose adding a LIMIT option to COPY FROM, which limits > the number of rows to load. > > With COPY TO, we can use the LIMIT clause in the query to restrict > output rows, but COPY FROM has no equivalent way to limit the number > of rows to load (except using the PROGRAM option with external tools > like head). This patch resolves that asymmetry. > > Syntax example: > - COPY t FROM STDIN (LIMIT 100); > I work with such scenarios a lot and I can't see why COPY should worry itself about such filtering. IRL most of what goes into COPY'S STDIN has already been filtered extensively, like ... | head -n 100 | COPY t FROM STDIN
