Re: Why my manualy constructed raw parser tree produce failed to execute? - Mailing list pgsql-hackers

From Mohammad Heykal Abdillah
Subject Re: Why my manualy constructed raw parser tree produce failed to execute?
Date
Msg-id 1275000989.1874.35.camel@claudia
Whole thread Raw
In response to Re: Why my manualy constructed raw parser tree produce failed to execute?  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Why my manualy constructed raw parser tree produce failed to execute?
List 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.abdillah@gmail.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.abdillah@gmail.com>



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Synchronization levels in SR
Next
From: David Fetter
Date:
Subject: Re: Specification for Trusted PLs?