Request for Formal Syntax of WHERE Clause Conditions

Started by PG Bug reporting formabout 1 year ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/sql-select.html
Description:

Dear PostgreSQL Team,

I am building a PostgreSQL parser and need a precise reference for the
formal syntax of condition used in the WHERE clause. While the documentation
covers many aspects in detail, I could not find a formal definition for what
constitutes a valid condition.

This information is critical for accurately parsing queries. Could you
please provide clarity or point me to relevant resources?

Thank you for your assistance!

Best regards,

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: Request for Formal Syntax of WHERE Clause Conditions

PG Doc comments form <noreply@postgresql.org> writes:

I am building a PostgreSQL parser and need a precise reference for the
formal syntax of condition used in the WHERE clause.

We do not have one. You might be able to extract what you need from
our Bison grammar though:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/parser/gram.y;h=d7f9c00c4099bd86c39ce79c997123a2a0ca6782;hb=HEAD

starting more or less from the a_expr production.

Keep in mind that this is a moving target, as we frequently add
new syntax features.

regards, tom lane