FYI. we usually does string manipulation in python, and we have built some utility functions around it (src/ports/postgres/modules/utilities/*.py_in). But, of course, it is not a hard requirement and I have not yet fully understood your implementation. Just for information and, of course, you are free to have your own design. Great to see new contributors to MADlib!