gram.y - Mailing list pgsql-hackers
From | Sferacarta Software |
---|---|
Subject | gram.y |
Date | |
Msg-id | 15557.981203@bo.nettuno.it Whole thread Raw |
List | pgsql-hackers |
Hi all, I'm trying to make parser recognize SELECTs between parenthesis. I need to do this work to have m$access working with PostgreSQL. The micro$oft access jet (great wisdom) translates the UNIONs as: (SELECT ...) UNION (SELECT ...) To have PostgreSQL understand this syntax I edited gram.y and I modified the "SelectStmt:" and the "SubUnion:" as: SelectStmt: opt_left_paren SELECT opt_unique res_target_list2 result from_clause where_clause group_clause having_clause opt_right_paren union_clause sort_clause { SelectStmt *n =makeNode(SelectStmt); n->unique = $3; n->targetList = $4; n->into = $5; n->fromClause = $6; n->whereClause = $7; n->groupClause = $8; n->havingClause = $9; n->unionClause = $11; n->sortClause = $12; $$ = (Node *)n; } ; SubUnion: opt_left_paren SELECT opt_unique res_target_list2 from_clause where_clause group_clause having_clause opt_right_paren { SelectStmt *n = makeNode(SelectStmt); n->unique = $3; n->unionall = FALSE; n->targetList = $4; n->fromClause = $5; n->whereClause = $6; n->groupClause = $7; n->havingClause = $8; $$ = (Node *)n; } ; and now with these changes I can specify SELECTs inside () and without parenthesis as before, I tried also subselects and seems that all works well...but when I tried a select with a function which contains parenthesis, like SUM(), VERSION() for example, then it doesn't work anymore. I'm not very good programing in C. Is there anybody that can help me with this question ? Any help would be very appreciated. EXAMPLES: (select (2-3)*3); ?column? -------- -3 (1 row) (select (132-3)*3) union all ( select ((983+1)/2) ); ?column? -------- 387 492 (2 rows) select (132-3)*3 union all select ((983+1)/2); ?column? -------- 387 492 (2 rows) select ename from emp where ename in ( select ename from emp where ename like 'K%' ); ename ----- KING (1 row) select version(); ERROR: parser: parse error at or near "(" -Jose'-
pgsql-hackers by date: