Andrew,
Thanks for sharing that. I reviewed your code. 10yrs, clearly it's not working (as-is, but close), something interesting about the
structure you ended up in. You check the type of the object and redirect accordingly at the top level. Hmmm...
What I liked was that each type gets handled (I was focused on "table"), but I realized similarities.
I don't know what the group would think, but I like the thought of calling this, and having it "Correct" to call the appropriate function.
But not sure it will stand. It does make obvious that some of these should be spun out as "pg_get_typedef"..
pg_get_typedef
pg_get_domaindef
pg_get_sequencedef
Finally, since you started this a while back, part of me is "leaning" towards a function:
pg_get_columndef
Which returns a properly formatted column for a table, type, or domain? (one of the reasons for this, is that this is
the function with the highest probability to change, and potentially the easiest to share reusability).
Finally, I am curious about your opinion. I noticed you used the internal pg_ tables, versus the information_schema...
I am *thinking* that the information_schema will be more stable over time... Thoughts?