Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge conflict resolution for 964d01 Automatically generate node support functions #58

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

Sairakan
Copy link

BABELFISH-CONFLICT: see Postgres community repo for original commit

Add a script to automatically generate the node support functions (copy, equal, out, and read, as well as the node tags enum) from the struct definitions.

For each of the four node support files, it creates two include files, e.g., copyfuncs.funcs.c and copyfuncs.switch.c, to include in the main file. All the scaffolding of the main file stays in place.

I have tried to mostly make the coverage of the output match what is currently there. For example, one could now do out/read coverage of utility statement nodes, but I have manually excluded those for now. The reason is mainly that it's easier to diff the before and after, and adding a bunch of stuff like this might require a separate analysis and review.

Subtyping (TidScan -> Scan) is supported.

For the hard cases, you can just write a manual function and exclude generating one. For the not so hard cases, there is a way of annotating struct fields to get special behaviors. For example, pg_node_attr(equal_ignore) has the field ignored in equal functions.

(In this patch, I have only ifdef'ed out the code to could be removed, mainly so that it won't constantly have merge conflicts. It will be deleted in a separate patch. All the code comments that are worth keeping from those sections have already been moved to the header files where the structs are defined.)

Reviewed-by: Tom Lane [email protected]
Discussion: https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce%40enterprisedb.com (cherry picked from commit 964d01ae90c314eb31132c2e7712d5d9fc237331)

Conflicts:

Merge conflict in src/backend/nodes/copyfuncs.c
<<<<<<< ours
		case T_TSQL_HexString:
			retval = _copyTSQL_HexString(from);
			break;
=======
#endif							/* OBSOLETE */
>>>>>>> theirs

Merge conflict in src/include/nodes/nodes.h
<<<<<<< ours
	T_SupportRequestWFuncMonotonic,	/* in nodes/supportnodes.h */

	/*
	 * Additional TAG FOR VALUE NODES (value.h)
	 */
	T_TSQL_HexString

=======
	T_SupportRequestWFuncMonotonic	/* in nodes/supportnodes.h */
#endif							/* OBSOLETE */
>>>>>>> theirs

Both conflicts resolved by taking new code (and thereby removing our reference to T_TSQL_HexString).

@Sairakan Sairakan force-pushed the pg16-cherry-pick-bff-1 branch from 4eac23a to 6eec548 Compare November 29, 2023 02:38
BABELFISH-CONFLICT: see Postgres community repo for original commit

Add a script to automatically generate the node support functions
(copy, equal, out, and read, as well as the node tags enum) from the
struct definitions.

For each of the four node support files, it creates two include files,
e.g., copyfuncs.funcs.c and copyfuncs.switch.c, to include in the main
file.  All the scaffolding of the main file stays in place.

I have tried to mostly make the coverage of the output match what is
currently there.  For example, one could now do out/read coverage of
utility statement nodes, but I have manually excluded those for now.
The reason is mainly that it's easier to diff the before and after,
and adding a bunch of stuff like this might require a separate
analysis and review.

Subtyping (TidScan -> Scan) is supported.

For the hard cases, you can just write a manual function and exclude
generating one.  For the not so hard cases, there is a way of
annotating struct fields to get special behaviors.  For example,
pg_node_attr(equal_ignore) has the field ignored in equal functions.

(In this patch, I have only ifdef'ed out the code to could be removed,
mainly so that it won't constantly have merge conflicts.  It will be
deleted in a separate patch.  All the code comments that are worth
keeping from those sections have already been moved to the header
files where the structs are defined.)

Reviewed-by: Tom Lane <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce%40enterprisedb.com
(cherry picked from commit 964d01ae90c314eb31132c2e7712d5d9fc237331)
Copy link

@priyansx priyansx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@priyansx priyansx merged commit 47188d3 into BABEL_main Nov 29, 2023
4 checks passed
@Sairakan Sairakan deleted the pg16-cherry-pick-bff-1 branch November 29, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants