Failed to parse new syntax - Mailing list pgsql-general

From jacktby jacktby
Subject Failed to parse new syntax
Date
Msg-id 8D78FF61-FE67-45C9-94D0-8EC7C7DFBEA5@gmail.com
Whole thread Raw
Responses Re: Failed to parse new syntax
List pgsql-general
/*
*    similarity_search_expr is used for our multi-mode
*    similarity_search, and we just use this for multi
*   cols search.
*/
similarity_search_expr:
    sub_search_expr '<' AexprConst {
        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "<", $1, $3, @2);
    }
    ;
sub_search_expr:
    '[' col_tuple_expr '~' AexprConst ']' {
        $$ = (Node *) makeSimpleA_Expr(AEXPR_OP, "~", $2, $4, @3);
    }
    ;
col_tuple_expr:
    columnref { $$ = $1;}
    | '(' col_list_expr ')' { $$ = $2;}
    ;
col_list_expr:
    columnref {
        ResTarget* target = makeNode(ResTarget);
        target->name = NULL;
        target->indirection = NIL;
        target->val = (Node *) $1;
        target->location = @1;
        $$ = list_make1(target);
    }
    | col_list_expr ',' columnref { $$ = lappend($1,$3);}
    ;
This is my new grammer.
But I get  below:
       postgres=# select * from t2 where [a ~ 1] < 0;
       ERROR:  syntax error at or near "~"
         LINE 1: select * from t2 where [a ~ 1] < 0;
It’s strange that it can’t parse ‘~’, I add it in the parser.


pgsql-general by date:

Previous
From: jacktby jacktby
Date:
Subject: How does pg parse 'select '(1,2)''
Next
From: Jan Wieck
Date:
Subject: Re: Failed to parse new syntax