On Tuesday, February 3, 2026, 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); > > This feature is useful for: > - Loading only the first N rows from a huge CSV file to verify data or > table definitions before a full import Would want it paired with offset for this use case. Design: > - The LIMIT count applies after WHERE filtering and ON_ERROR skipping, > so it represents the actual number of rows inserted. Not sure about that choice. I’d go with pre-eval or implement both and default to pre-eval. David J.
