On Mon, Sep 9, 2024 at 2:02 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > By that argument, we should move every declaration in every .c file > into c.h and be done. I'd personally be happier if we had *not* > exposed the other data structure details you mention, but that > ship has sailed.
Not every declaration in every .c file is of general interest, but the ones that are probably should be moved into .h files. The on-disk representation of a commonly-used data type certainly qualifies. You can see from Chapman's reply that I'm not making this up: when we don't expose things, it doesn't keep people from depending on them, it just makes them copy our code into their own repository. That's not a win. It makes those extensions more fragile, not less, and it makes the PostgreSQL extension ecosystem worse. pg_hint_plan is another, recently-discussed example of this phenomenon: refuse to give people the keys, and they start hot-wiring stuff. > If we do do what you're advocating, I'd at least insist that the > declarations go into a new file numeric_internal.h, so that it's > clear to all concerned that they're playing with fire if they > depend on that stuff. I think that's a bit pointless considering that we don't do it in any of the other cases. I'd rather be consistent with our usual practice. But if it ends up in a separate header file that's still better than the status quo. -- Robert Haas EDB: http://www.enterprisedb.com