Open kbrannen opened 1 year ago
@theory what are your thoughts on this on the function naming ?
If the following seems ok for you ?
SELECT table_comment_is ( :schema, :table, :comment, :description );
SELECT table_comment_is ( :schema, :table, :comment );
SELECT table_comment_is ( :table, :comment, :description );
SELECT table_comment_is ( :table, :comment );
SELECT column_comment_is ( :schema, :table, :column, :comment, :description );
SELECT column_comment_is ( :schema, :table, :column, :comment );
SELECT column_comment_is ( :table, :column, :comment, :description );
SELECT column_comment_is ( :table, :column, :comment );
And so on for other objects ?
Yeah, that looks like other stuff we have now.
This is probably incredibly low on the priority list, but it just occurred to me that there is no has_comment() function. I don't think we need hasnt_comment(), but it could be done if it was simple as doing "select not has_comment(...)".
There are 2 paths to take on this if done:
It gets a little crazy because just about every type of object can have a comment. I think I'd rather do 1 to avoid a proliferation of functions.
I'm not sure if we want to check if the object simply has a comment which would be "has_comment()", or if we'd care about know that the comment value is what we expect which I think would work better with "comment_is()". Or do we need both? :)
You can see the comments by adding "+" to almost any command in psql, e.g. \l+, \dt+, \d+, \dn+, etc. The comment will show in the "Description" column. The value gets there with the command
COMMENT ON {object} {name} IS '{description}';
hence has_comment() but I suppose we could call it has_description().