Re: [HACKERS] pg_get_viewdef 7.4 et al

Поиск
Список
Период
Сортировка
От Andreas Pflug
Тема Re: [HACKERS] pg_get_viewdef 7.4 et al
Дата
Msg-id 3E93FCA0.1020402@web.de
обсуждение исходный текст
Список pgadmin-hackers
Tom,

I believe we have to discuss this a little more in-depth.
Parenthese-usage needs theroretical proof, since not all cases can be
tested. So I list the  assumptions I made.

- JOINS:
A JOIN can only have RangeTblRef or JoinExpr as left and right argument.
RangeTblRef is trivial, no parentheses needed. JoinExpr on the left dont
need them either because that represents the standard evaluation order.
JoinExpr on the right needs parentheses (at least for clarification). ON
clause won't need them.

A is left of B, left of join root, (C JOIN D) is right of join root
A JOIN B ON xxx
     JOIN (C JOIN D ON xxx) ON xxx


- general:
T_Var, T_Const, T_Param, T_Aggref, T_ArrayRef, T_FuncExpr,
T_DistinctExpr, T_SubLink, T_SubPlan, T_FieldSelect, T_NullIfExpr,
T_NullTest, T_BooleanTest, T_CoerceToDomainValue can be handled as a
simple argument.

- T_CoerceToDomain and T_RelabelType:
Both only take simple arguments, no complex expressions and thus don't
need parentheses. The typecast will stick correctly to its argument on
the left (rtfm 1.1.6 Table 1.1).


- T_BoolExpr:
Arguments will have precedence over AND/OR/NOT, unless they are
T_BoolExpr themselves. (according rtfm 1.1.6 Table 1.1)

- T_OperExpr:
Arguments only need parentheses if they are of type T_OperExpr or
T_BoolExpr. The second is presently disregarded in my code (didn't think
of bool operators), needs addition in get_rule_expr_paren().

- T_NullTest, T_BooleanTest
Could be optimized (handled like T_OperExpr) without loosing their
"simple argument" status for T_BoolExpr


Regards,
Andreas


В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Andreas Pflug
Дата:
Сообщение: Re: pgadmin3 GTK
Следующее
От: "Dave Page"
Дата:
Сообщение: CVS Server