Re: How does pg parse 'select '(1,2)''

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: jacktby(at)gmail(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How does pg parse 'select '(1,2)''
Date: 2023-08-07 05:54:42
Message-ID: 20230807.145442.813357160212428987.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At Sat, 5 Aug 2023 21:46:33 +0800, jacktby jacktby <jacktby(at)gmail(dot)com> wrote in
> I’m trying to add new grammar for my application. So I’m do research on gram.y.
> I think it will make the '(1,2)' as " '(' a_expr ')' "; but I can’t find out something like
> " a_expr ',' a_expr “, can you give me the details?

If you are trying literally "SELECT (1, 2)", I think that the parser
comes to the terminating a_expr through the following path.

<omitted>
simple_select: SELECT .. opt_target_list ...
opt_target_list: target_list
target_list: target_el | target list '.' target_el
target_el: a_expr
a_expr: c_expr
c_expr: implicit_row
implicit_row: '(' expr_list ',' a_expr ')'
expr_list: a_expr | expr_list ',' a_expr

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-general by date

  From Date Subject
Next Message KK CHN 2023-08-07 12:05:42 Re: Backup Copy of a Production server.
Previous Message Thomas Kellerer 2023-08-07 05:50:50 Re: Dropping all tables in a database