Re: Improve Assert output

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve Assert output
Date: 2019-08-14 20:36:40
Message-ID: 1430.1565815000@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> This kind of output is usually not helpful:
> TRAP: BadArgument("((context) != ((void *)0) && (((((const
> Node*)((context)))->type) == T_AllocSetContext) || ((((const
> Node*)((context)))->type) == T_SlabContext) || ((((const
> Node*)((context)))->type) == T_GenerationContext)))", File:
> "../../../../src/include/utils/memutils.h", Line: 129)

> What we probably want is something like:

> TRAP: BadArgument("MemoryContextIsValid(context)", File:
> "../../../../src/include/utils/memutils.h", Line: 129)

+1, that would be a big improvement. The other thing that this
is fixing is that the existing output for Assert et al shows
the *inverted* condition, which I for one always found confusing.

I didn't try to test the patch, but it passes eyeball examination.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2019-08-14 21:15:20 Re: [PATCH] Stop ALTER SYSTEM from making bad assumptions
Previous Message Peter Eisentraut 2019-08-14 20:28:55 Improve Assert output