Re: AllocSetContextCreate changes breake extensions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Christoph Berg <cb(at)df7cb(dot)de>
Subject: Re: AllocSetContextCreate changes breake extensions
Date: 2018-10-12 17:20:16
Message-ID: 12539.1539364816@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2018-10-12 17:32:33 Re: AllocSetContextCreate changes breake extensions
Previous Message Christoph Berg 2018-10-12 17:10:41 Re: AllocSetContextCreate changes breake extensions