About adding a new filed to a struct in primnodes.h

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: About adding a new filed to a struct in primnodes.h
Date: 2020-11-24 13:49:25
Message-ID: CAKU4AWp7zCdGsQ7pR_Eza1wrbb1fwb6X2c7RE6XoNKfg1+_nqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi:

For example, we added a new field in a node in primnodes.h

struct FuncExpr
{

+ int newf;
};

then we modified the copy/read/out functions for this node. In
_readFuncExpr,
we probably add something like

static FuncExpr
_readFuncExpr(..)
{
..
+ READ_INT_FILED(newf);
};

Then we will get a compatible issue if we create a view with the node in
the older version and access the view with the new binary. I think we can
have bypass this issue easily with something like

READ_INT_FIELD_UNMUST(newf, defaultvalue);

However I didn't see any code like this in our code base. does it doesn't
work or is it something not worth doing?

--
Best Regards
Andy Fan

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-11-24 13:56:33 Re: Remove cache_plan argument comments to ri_PlanCheck
Previous Message Robert Haas 2020-11-24 13:44:08 Re: [HACKERS] Custom compression methods