Re: pg_dump: assert failure sorting casts/transforms
Re: pg_dump: assert failure sorting casts/transforms
Hi,
On Thu, 20 Aug 2026 at 13:04, Nitin Jadhav <nitinjadhavpostgres@gmail.com> wrote:
One small test-coverage suggestion - the added cast test exercises the
casttarget tie-breaker, because both casts use the same source type
and only the target type differs by schema. Since the patch also adds
a castsource tie-breaker, it may be worth adding a symmetric case
where two source types share the same typname across schemas and cast
to the same target type. That would cover both new comparisons
explicitly.
Thank you for a review Nitin, here is a v2 version of the patch with extended test coverage.
Regards,
--
Alexander Kukushkin
Re: pg_dump: assert failure sorting casts/transforms
От:
Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Дата:
> Thank you for a review Nitin, here is a v2 version of the patch with extended test coverage. Thanks Alexander, v2 addresses my earlier comment. The added src2 casts now cover the case where the source type's schema is the distinguishing part of the cast key, so both the castsource and casttarget comparisons are exercised. I noticed one small test-completeness nit: the test creates four casts, but I see regex checks for only three emitted CREATE CAST statements. The unchecked one appears to be: CREATE CAST (public.dump_cast_src2 AS public.dump_cast_tgt) WITH INOUT; Since this is the public-side member of the new source-type ambiguity pair, would it be worth adding a matching regexp for symmetry/completeness? A couple of minor readability thoughts: Now that the test covers two separate cases, target-side and source-side ambiguity, perhaps the test type names could make that distinction explicit. For example, instead of using dump_cast_src2, names along these lines might make the intent clearer: public.dump_cast_src_for_target_test, public.dump_cast_src_for_source_test,dump_cast_schema.dump_cast_src_for_source_test. That would make it easier to see which casts exercise the target-type tie-breaker and which casts exercise the source-type tie-breaker. The DO_TRANSFORM comment says "Same unqualified-typname ambiguity as casts; break by type." That is understandable, but maybe it could mention why comparing only trftype is enough here: the language name has already been compared as part of dobj.name, so trftype is the remaining natural-key field that can distinguish the two transform objects. These are minor; the code change itself looks reasonable to me. Best Regards, Nitin Jadhav Azure Database for PostgreSQL Microsoft
Re: pg_dump: assert failure sorting casts/transforms
От:
Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Дата:
> here is v3 version of the patch addressing all nit-picks Thanks for the v3 patch. It addresses my earlier comments, and the fix and regression coverage look good to me. I have no other comments. One optional follow-up thought: the current tests exercise the assertion-failure case well. Order-aware checks could additionally verify the OID-independent ordering property and help detect future regressions to an OID fallback. I realize the earlier natural-key ordering changes do not consistently include explicit output-order checks either, so I do not think this should delay the current patch or require a v4. If there is interest, I can investigate a separate follow-up patch for suitable coverage of this case and the earlier OID-independence cases. Since the issue also affects REL_19_STABLE, I think the fix should be applied there along with master. No older back-branches appear to be affected. Best Regards, Nitin Jadhav Azure Database for PostgreSQL Microsoft
Re: pg_dump: assert failure sorting casts/transforms
Hi Noah,
sorry that it took so long to get back.
On Wed, 9 Sept 2026 at 02:04, Noah Misch <noah@leadboat.com> wrote:
Since this is already the fourth follow-up to my original change, I had Opus 5
look for more ways to reach the assertion. It found one more:
D1 DO_POLICY: the "RLS enabled" pseudo-object borrows its table's relname, so
it ties with a policy named after that same table. An assert-enabled
pg_dump aborts; a production build orders the two by comparing a pg_class
OID against a pg_policy OID, which pg_upgrade inverts.
Let's fix that at the same time. Would you like to add that, or would you
like me to add it?
Please find the attached v4 version of the patch that also handles RLS policies.
--
Regards,
--
Alexander Kukushkin