Re: Why my manualy constructed raw parser tree produce failed to execute?

From: Mohammad Heykal Abdillah <heykal(dot)abdillah(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why my manualy constructed raw parser tree produce failed to execute?
Date: 2010-05-27 22:56:29
Message-ID: 1275000989.1874.35.camel@claudia
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Kam, 2010-05-27 at 15:02 -0400, Robert Haas wrote:
> On Thu, May 27, 2010 at 1:58 PM, Mohammad Heykal Abdillah
> <heykal(dot)abdillah(at)gmail(dot)com> wrote:
> > Now to the question, why my manualy constructed list was failed to
> > execute? I was pretty sure that my list node was identical with yacc.
>
> Because you have a bug in your code.
>
Yes, that i know.

Anyway, this is my manualy generate list node i hope you can point me
where it went wrong :
In function "pg_parse_query(const char *query_string)"

List *my_parsetree_list;
my_parsetree_list = NIL;

ColumnRef *o = makeNode(ColumnRef);
o->type = T_ColumnRef;
o->fields = list_make1(makeString("*"));
o->location = 16;

ResTarget *m = makeNode(ResTarget);
m->type = T_ResTarget;
m->name = NIL;
m->indirection = NIL;
m->val = o;
m->location = 16;

RangeVar *p = makeNode(RangeVar);
p->schemaname = NIL;
p->relname = "customer";
p->inhOpt = 2;
p->istemp = false ;
p->alias = NIL;

SelectStmt *n = makeNode(SelectStmt);
n->type = T_SelectStmt;
n->distinctClause = list_make1(NIL);;
n->intoClause = NULL;
n->targetList = list_make1(m);
n->fromClause = list_make1(p);
n->whereClause = NULL;
n->groupClause = NIL;
n->havingClause = NULL;
n->valuesLists = NIL;
n->sortClause = NIL;
n->limitOffset = NULL;
n->limitCount = NULL;
n->lockingClause = NIL;
n->op = 0;
n->all = false;
n->larg = NULL;
n->rarg = NULL;

my_parsetree_list = list_make1(n);

raw_parsetree_list = my_parsetree_list;
if (log_parser_stats)
ShowUsage("PARSER STATISTICS"); ...
... and rest its same with original code.

Thank You
--
Mohammad Heykal Abdillah <heykal(dot)abdillah(at)gmail(dot)com>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2010-05-27 23:10:15 Re: Specification for Trusted PLs?
Previous Message Robert Haas 2010-05-27 22:47:34 Re: Synchronization levels in SR