pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jacktby jacktby <jacktby@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Failed to parse new syntax
Date: Sat, 5 Aug 2023 23:56:18 +0800
Message-ID: <8D78FF61-FE67-45C9-94D0-8EC7C7DFBEA5@gmail.com> (raw)

/*
*	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.




view thread (2+ messages)  latest in thread

Message-ID: <8D78FF61-FE67-45C9-94D0-8EC7C7DFBEA5@gmail.com>
Permalink:  ../8D78FF61-FE67-45C9-94D0-8EC7C7DFBEA5@gmail.com/
Also on:    postgresql.org/message-id/8D78FF61-FE67-45C9-94D0-8EC7C7DFBEA5@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: jacktby@gmail.com
  Subject: Re: Failed to parse new syntax
  In-Reply-To: <8D78FF61-FE67-45C9-94D0-8EC7C7DFBEA5@gmail.com>
  References: <8D78FF61-FE67-45C9-94D0-8EC7C7DFBEA5@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox