| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: improve performance of pg_dump with many sequences |
| Date: | 2026-01-08 19:34:28 |
| Message-ID: | aWAGxA8igE1ZG_Xq@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Jan 08, 2026 at 01:19:39PM -0500, Tom Lane wrote:
> One nitpicky point is that try_sequence_open() will still error out
> if it is given an OID that is a non-sequence relation. I think it'd
> be more desirable for it to close the relation again and return NULL.
> That's probably insignificant for pg_dump's usage, because we could
> only hit the case with very improbable OID wraparound timing. But
> I think our experience with catalog-inspection functions similar to
> pg_get_sequence_data is that it's usually better to return NULL than
> throw an error.
Hm. That makes sense, but both try_table_open and try_index_open error for
wrong relkinds. I could change all of the try_*_open functions to return
NULL in that case, or I could just open-code the relkind check in
pg_get_sequence_data after try_relation_open (and have it return NULL for
non-sequences). I'm leaning towards the latter, if for no other reason
than it might be slightly nicer for back-patching (e.g., smaller, no new
extern functions).
--
nathan
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-pg_dump-fix-use-of-pg_get_sequence_data.patch | text/plain | 3.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2026-01-08 19:37:26 | Re: pg_plan_advice |
| Previous Message | Bernd Helmle | 2026-01-08 19:24:32 | Re: [PATCH] Provide support for trailing commas |