Re: Getting "ERROR: unrecognized node type: 444" while creating an AST

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amaan Haque <amaanhaque(at)microsoft(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Getting "ERROR: unrecognized node type: 444" while creating an AST
Date: 2024-10-05 02:28:45
Message-ID: 746346.1728095325@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Amaan Haque <amaanhaque(at)microsoft(dot)com> writes:
> I’m trying to create an AST representation of a query for the `INSERT` operation. ...

> I found through logs that the error originates from line 2053 in `NodeFuncs.c`. I can’t correlate the unrecognized node to any enum value in `Nodes.h`. Any pointers on how to navigate that file would be greatly appreciated!

I think most of us rely on gdb these days. In community v16
I get:

(gdb) p (NodeTag) 444
$1 = T_String

You might have better luck identifying just where it's failing
if you recompile nodeFuncs.c with -O0.

The most obviously fishy thing I'm seeing in your code is

> A_Expr *onConflictWhereExpr = makeSimpleA_Expr(AEXPR_OP, "<", (Node *)conflictColumnRef,
> (Node *)makeConst(INT8OID, -1, InvalidOid, sizeof(int64),
> Int64GetDatum((int)myTimestamp), false, true), -1);

An A_Expr is only valid in raw_parser output, but what you seem
to be trying to construct is a post-parse-analysis tree.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2024-10-05 03:37:34 Re: SET ROLE and parameter status
Previous Message Alexander Korotkov 2024-10-04 22:31:48 Re: POC, WIP: OR-clause support for indexes