Generating DDL (specific to postgres) Scripts Conditionally
-
25-09-2019 - |
Question
My application does not fit into the "general purpose" RDBMS schema category, I do not want a ginormous DDL script -- therefore I would need #include
semantics and I will probably have different variants of the scripts therefore I would need #ifdef
semantics.
Is GNU m4 the way to go?
Or perhaps there are some macro capabilities in psql
?
edit: After a while of working with m4 it seems to fit the bill, I have answered the question below (won't accept for a while), but if you feel you can add more to this question please do so.
Solution
Yes m4 is a suitable tool for this particular style of coding -- remember though: don't go overboard with adding too many macros.
As the manual states m4 is addictive, so be careful.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow