strange bison, cannot remove reduce

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: strange bison, cannot remove reduce
Date: 2007-11-21 21:02:57
Message-ID: 162867790711211302l139d48feia963762bf191ffd1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-11-21 21:09:39 Re: 8.3devel slower than 8.2 under read-only load
Previous Message Tom Lane 2007-11-21 20:33:53 Re: Re: pgsql: New versions of mingw have gettimeofday(), so add an autoconf