Why does exprCollation reject List node?

From: Shigeru HANADA <shigeru(dot)hanada(at)gmail(dot)com>
To: "pgsql-hackers >> PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Why does exprCollation reject List node?
Date: 2012-03-16 10:48:58
Message-ID: 4F631A9A.2020209@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

During writing pgsql_fdw codes, I noticed that exprCollation rejects
non-Expr nodes with error "unrecognized node type: %d". Is this
intentional behavior, or can it return InvalidOid for unrecognized nodes
like exprInputCollation?

Background information: I use exprCollation with expression_walker in
pgsql_fdw to know whether an expression in baserestrictinfo->clause list
uses any collation, to determine the clause can be pushed down safely.
I want to allow pushing ScalarArrayOpExpr down, but its argument is
represented as List, so a query contains ScalarArrayOpExpr ends with
error when the traversing expression tree reaches arguments of
ScalarArrayOpExpr.

I've spent only few hours for research though, but the interface of
exprCollation seems little odd. It accepts Node*, but its switch
statement assumes that given object should be something derived from
Expr, and it rejects other objects with elog(ERROR).

Anyone know the reason?

Regards,
--
Shigeru Hanada

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-03-16 11:42:20 Re: Command Triggers, v16
Previous Message Andres Freund 2012-03-16 10:25:01 Re: initdb and fsync