On Tue, Jun 03, 2025 at 01:04:36PM -0500, Sami Imseih wrote: > v3 is what I'm thinking: In FetchStmt, introduce a new field called > explicit_direction (maybe there's a better name?), which is an int that > we can assign a value to in gram.c. The value will be 0 if no explicit > direction is used. Otherwise, each of the explicit directions (i.e., FIRST, > LAST, BACKWARD) will be assigned a unique value. FORWARD ALL and > BACKWARD ALL will be treated as distinct from FORWARD and BACKWARD.
Hmm. I was not sure if we'd really need to get down to that, as most of the grammar keywords have the same parsed meaning, but there's a good point with LAST for example that uses a negative value for howMany. If we silence the number, LAST would map with everything else that has FETCH_ABSOLUTE. That would be confusing. > I considered introducing an enum for these explicit direction values, but > didn’t find it particularly useful. If you think it would be beneficial, > I can define an enum in parsenodes.h An enum would shine here IMO, because the value could be self-documented and one would not need to guess what each integer value means. That could be something like a direction_keyword, filled with FETCH_KEYWORD_LAST, FETCH_KEYWORD_BACKWARD, etc. -- Michael
signature.asc
Description: PGP signature