Re: OK for ABI break of PlannerInfo in 8.4?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: OK for ABI break of PlannerInfo in 8.4?
Date: 2010-03-30 16:55:59
Message-ID: 25306.1269968159@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> Seems OK to me. It's worth noting though that if a module does do
> palloc+memcpy of PlannerInfo, and it's compiled against the new sources
> with the extra field, but used on an old server version, it will
> memcpy() from beyond the end of the struct. If you're seriously unlucky
> and the struct is at the end of allocated address space, that can segfault.

Yeah, and in the converse case (copied version is too small) the
reference from relation_excluded_by_constraints could segfault.
But actually, neither will happen because palloc rounds the struct
size up to a power of 2, so there will be some memory there; it
just might contain garbage.

> Unfortunately there doesn't seem to be any alignment padding in the
> struct either. You could've stuck the new field there and avoided
> changing sizeof(PlannerInfo).

Yeah, I looked for some pad space :-(

The alternative fix for 8.4 would be to not add the field but instead
grovel through app_info_list to see if the target relation is a child.
I discarded this approach because the whole point of
"constraint_exclusion = partition" is to not add overhead to simple
non-inheritance queries. However, if we think the ABI break is actually
worth worrying about then maybe that's the better fix.

I'm inclined not to worry, in part because I'm not aware of any
third-party planner hooks actually being used in production.
Does anyone know of one?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2010-03-30 20:43:21 Re: Alpha release this week?
Previous Message Hiroshi Saito 2010-03-30 16:52:50 Re: UUIDs generated using ossp-uuid on windows not unique