pg_dump: Add ExecuteSqlCopy and simplify ExecuteSqlQuery

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: pg_dump: Add ExecuteSqlCopy and simplify ExecuteSqlQuery
Date: 2025-12-16 21:38:23
Message-ID: CADkLM=dvKHrt864audavQXB-yATV_4Vj+Qo_AgFhtv0ka2xdLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The thread about tablecmds.c being too large for some code inspection
tooling got me thinking about ways to improve the second worst offender:
pg_dump.c.

Those investigations of mine haven't yet revealed a way to split the file
that I find effective, let alone helpful. However, it has shown me a few
patterns within pg_dump.c that I'm proposing to change.

Of the current 84 calls to the convenience routine ExecuteSqlQuery(), 83 of
them are regular queries which expect a result of PGRES_TUPLES_OK. The
other one expects PGRES_COPY_OUT. So it seems worthwhile to remove the
parameter entirely and assume the caller wants PGRES_TUPLES_OK. For the one
exception, ExecuteSqlCopy() is created, though one could argue that we
might just do without the convenience routine altogether. Patch attached.

Attachment Content-Type Size
v1-0001-Split-ExecuteSqlCopy-from-ExecuteSqlQuery.patch text/x-patch 27.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-12-16 21:40:45 Re: [PATCH] Fix ARM64/MSVC atomic memory ordering issues on Win11 by adding explicit DMB ?barriers
Previous Message Jeff Davis 2025-12-16 21:19:12 Re: Remaining dependency on setlocale()