> Hmm, we could do that to differentiate the keyword ALL. I had a thought
> earlier about differentiating the other keywords as well: FIRST, LAST,
> BACKWARD, FORWARD, and ABSOLUTE. Initially, I thought it might
> be a bit too much, but I do see the merit in this approach, as these are
> syntactically different from their numeric counterparts.
>
> We can accomplish this with just an extra field in FetchStmt, where each
> of these keywords gets a distinct value.
>
> What do you think?

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.

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

I also slightly reorganized the fetch_args so the like values for
n->explicit_direction are nearby each other. It does not change
the behavior.

Also, modified the tests to match and some additional code comments.

--
Sami Imseih
Amazon Web Services (AWS)

Attachment: v3-0001-Normalize-variable-fetch-sizes-in-a-FETCH-command.patch
Description: Binary data

Reply via email to