Re: AllocSetContextCreate changes breake extensions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AllocSetContextCreate changes breake extensions
Date
Msg-id 12539.1539364816@sss.pgh.pa.us
Whole thread Raw
In response to AllocSetContextCreate changes breake extensions  (Andres Freund <andres@anarazel.de>)
Responses Re: AllocSetContextCreate changes breake extensions  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Christoph Berg, on IRC, raised the issue that at least one extension
> failed compiling in v11. The extension currently does:
> https://github.com/pgq/pgq/blob/master/triggers/common.c#L225
>     tbl_cache_ctx = AllocSetContextCreate(TopMemoryContext,
>                           "pgq_triggers table info",
>                           ALLOCSET_SMALL_MINSIZE,
>                           ALLOCSET_SMALL_INITSIZE,
>                                               ALLOCSET_SMALL_MAXSIZE);

> which makes sense, because it has to support versions below 9.6, which
> introduced ALLOCSET_SMALL_SIZES etc.

Yeah, we discussed that at the time and thought it was acceptable
collateral damage.  It's not like nobody ever breaks API in new major
versions.

> Based on a quick look, ISTM the easiest fix is to have the
> AllocSetContextCreate accept five parameters, and move it below the
> ALLOCSET_*_SIZES macros. That way they should be expanded before
> AllocSetContextCreate(), and thus 5 params should be fine.

Huh?  The order in which you #define macros doesn't affect expansion.

We could make this work more conveniently on compilers supporting
__VA_ARGS__, though.  That's certainly good enough in HEAD, and
probably good enough for most people in 11.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: AllocSetContextCreate changes breake extensions
Next
From: Chapman Flack
Date:
Subject: Re: AllocSetContextCreate changes breake extensions