In readfast.c/outfast.c, reuse functions from readfuncs.c/outfuncs.c.
Currently, readfast.c / outfast.c are mostly copy-pasted from readfuncs.c / outfuncs.c. That's a merge hazard: if a new field is added to a struct in upstream, and it's added to readfuncs.c and outfuncs.c, we would need to manually do the same in the readfast.c/outfast.c. If the patch applies cleanly, we will not notice, and we'll have a bug of omission. Refactor the code so that all those node types where the text and binary functions are identical, the duplicate in [read/out]fast.c is removed, and the definition [read/out]funcs.c is used to compile the binary version too. This involves some tricks with #ifdefs and #includes, but cuts a lot of duplicate code. This should avoid the merge hazard. We'll still need to maintain the read/out functions whenever we modify a struct in Greenplum, but that's no different from what needs to be done in PostgreSQL.
Showing
想要评论请 注册 或 登录