How to make a OpExpr check compatible among different versions

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: How to make a OpExpr check compatible among different versions
Date: 2020-01-13 07:29:27
Message-ID: CAKU4AWqrv8AZQFi7x2O2cME2ifDw18ZDRzuQnMgWwiXyJo_RfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

During one of my works for logical rewrite, I want to check if the expr is
a given Expr.

so the simplest way is:
if (expr->opno == 418 && nodeTag(linitial(expr->args)) == T_xxx &&
nodeTag(lsecond(expr->args)) == T_yyyy )
{
..
}

if we write code like above, we may have issues if the oid changed in the
future version.
so what would be your suggestion?

Thanks

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2020-01-13 08:08:40 Re: [Proposal] Global temporary tables
Previous Message Antonin Houska 2020-01-13 07:22:13 Comment fix in session.h