Обсуждение: [GENERAL] how to use the struct "RangeFunction" in Postgres 9.6 ?

Поиск
Список
Период
Сортировка

[GENERAL] how to use the struct "RangeFunction" in Postgres 9.6 ?

От
lin
Дата:
Hi all,
  I am puzzled for how to use the struct "RangeFunction" in Postgres 9.6, the struct "RangeFunction" is not the same with 9.3.
Can someone help me how to write the function "make_RangeFunction"?

the code as below: 
               SelectStmt *stmt = makeNode(SelectStmt);
List *args = list_make1(makeStringConst($2, @2));
args = lappend(args, makeStringConst($3, @3));
stmt->targetList = list_make1(make_star_target(-1));
stmt->fromClause = list_make1(make_RangeFunction("function_name", args));
static Node* make_RangeFunction(const char *func_name, List *func_args)
{
  RangeFunction *n = makeNode(RangeFunction);
.... (how to write this function)
}

Thanks,
  wln


 

Re: [GENERAL] how to use the struct "RangeFunction" in Postgres 9.6 ?

От
Tom Lane
Дата:
lin <jluwln@163.com> writes:
>   I am puzzled for how to use the struct "RangeFunction" in Postgres 9.6, the struct "RangeFunction" is not the same
with9.3. 
> Can someone help me how to write the function "make_RangeFunction"?

You probably want to look at "func_table:" and associated productions
in gram.y, and maybe compare those to the RangeFunction-making productions
in 9.3's gram.y.

(Since RangeFunction isn't used past the raw parsetree stage, it's not
very clear to me why you'd need to make one anywhere else ...)

            regards, tom lane