On Wed, Feb 10, 2021 at 2:04 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > That is a spot-on definition of where I do NOT want to end up. Hooks > everywhere and enormous extensions that break anytime we change anything > in the core. It's not really clear that anybody is going to find that > more maintainable than a straight fork, except to the extent that it > enables the erstwhile forkers to shove some of their work onto the PG > community.
+1. Making the lexer and parser extensible seems desirable to me. It would be beneficial not only for companies like EDB and Amazon that might want to extend the grammar in various ways, but also for extension authors. However, it's vastly harder than Jan's proposal to make the wire protocol pluggable. The wire protocol is pretty well-isolated from the rest of the system. As long as you can get queries out of the packets the client sends and package up the results to send back, it's all good. The parser, on the other hand, is not at all well-isolated from the rest of the system. There's a LOT of code that knows a whole lot of stuff about the structure of parse trees, so your variant parser can't produce parse trees for new kinds of DDL, or for new query constructs. And if it parsed some completely different syntax where, say, joins were not explicit, it would still have to figure out how to represent them in a way that looked just like it came out of the regular parser -- otherwise, parse analysis and query planning and so forth are not going to work, unless you go and change a lot of other code too, and I don't really have any idea how we could solve that, even in theory. But that kind of thing just isn't a problem for the proposal on this thread. That being said, I'm not in favor of transferring maintenance work to the community for this set of hooks any more than I am for something on the parsing side. In general, I'm in favor of as much extensibility as we can reasonably create, but with a complicated proposal like this one, the community should expect to be able to get something out of it. And so far what I hear Jan saying is that these hooks could in theory be used for things other than Amazon's proprietary efforts and those things could in theory bring benefits to the community, but there are no actual plans to do anything with this that would benefit anyone other than Amazon. Which seems to bring us right back to expecting the community to maintain things for the benefit of third-party forks. -- Robert Haas EDB: http://www.enterprisedb.com