Re: Violation of principle that plan trees are read-only
От | Jose Luis Tallon |
---|---|
Тема | Re: Violation of principle that plan trees are read-only |
Дата | |
Msg-id | 2437dab7-396e-fa2c-82a4-dec101621061@adv-solutions.net обсуждение исходный текст |
Ответ на | Re: Violation of principle that plan trees are read-only (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On 19/5/25 16:45, Tom Lane wrote: > [snip] > For one thing, I'm not sure how to teach the compiler that casting > "Query *" to "ConstQuery *" is okay but vice versa isn't. > > Does C++ have a better story in this area? Hi, A C++ compiler *does* enforce "const correctness" (for examples see, for example, Meyer's fantastic "Efficient C++" series). It seems that Postgres is approaching the class of complexity/maturity that (modern) C++ was designed to solve. It should be unmatched in that area. I believe that, with recent platform deprecations, the vast majority of systems where one can compile a modern Postgres should already have a decent C++ compiler available (g++ & clang probably cover >95%) As opposed to say, rewriting in Rust ---where the compilar also does a very substantial checking of semantics at compile time---, introducing some C++ in Postgres could be as simple as throwing some "#ifdef __cplusplus__ extern "C" { #endif" in the headers and use the required subset in certain modules *only*. (this is how, for instance, Bacula did it ~two decades ago) The planner and parts of the bufmgr / arenas (palloc et al.) seem to me as the most obvious candidates to try. I'm not sure whether it'd introduce any unintended regressions, though. > I haven't touched it > in so long that I don't remember. C++ 17 would be the standard to tackle, IMHO. HTH, J.L. -- Parkinson's Law: Work expands to fill the time alloted to it.
В списке pgsql-hackers по дате отправления: