hello

I am playing with methods. It's +/- function with first hidden arguments.

example: sin(10)  ~ (10).sin() is equivalent.
legal is substring('aaaa',1,3).upper() too etc

I spent some time with bison (without success).

indirection_el:
                        '.' attr_name
                                {
                                        $$ = (Node *) makeString($2);
                                }
                        | '.' attr_name '(' ')'
                                {
                                        $$ = (Node *) makeString($2);
                                }
                        | '.' attr_name '(' expr_list ')'
                                {
                                        $$ = (Node *) makeString($2);
                                }
                        | '.' '*'
                                {
                                        $$ = (Node *) makeString("*");
                                }
this is correct but doesn't work
postgres=# select (10).aaa.aaaa.bbbb.procedure(10);
ERROR:  syntax error at or near "("
LINE 1: select (10).aaa.aaaa.bbbb.procedure(10);
                                           ^
postgres=# select (10).aaa.aaaa.bbbb.procedure();
ERROR:  syntax error at or near "("
LINE 1: select (10).aaa.aaaa.bbbb.procedure();

correct is
indirection_el:
                        '.' attr_name
                                {
                                        $$ = (Node *) makeString($2);
                                }
                        | '.' type_function_name '(' ')'
                                {
                                        $$ = (Node *) makeString($2);
                                }
                        | '.' type_function_name '(' expr_list ')'
                                {
                                        $$ = (Node *) makeString($2);
                                }
                        | '.' '*'
                                {
                                        $$ = (Node *) makeString("*");
                                }

It works
postgres=# select (10).aaa(10).ajjaja(10).qqq();
ERROR:  column notation .aaa applied to type integer, which is not a
composite type

but there are
 bison gram.y
gram.y: conflicts: 3 reduce/reduce

state 1160

  1436 type_function_name: IDENT .
  1439 ColLabel: IDENT .

    '('       reduce using rule 1436 (type_function_name)
    '('       [reduce using rule 1439 (ColLabel)]
    $default  reduce using rule 1439 (ColLabel)

state 1165

  1437 type_function_name: unreserved_keyword .
  1440 ColLabel: unreserved_keyword .

    '('       reduce using rule 1437 (type_function_name)
    '('       [reduce using rule 1440 (ColLabel)]
    $default  reduce using rule 1440 (ColLabel)

state 1167

  1438 type_function_name: type_func_name_keyword .
  1442 ColLabel: type_func_name_keyword .

    '('       reduce using rule 1438 (type_function_name)
    '('       [reduce using rule 1442 (ColLabel)]
    $default  reduce using rule 1442 (ColLabel)

Any ideas?
Regards
Pavel

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to