Hi! I have read the discussion and would like to share my humble opinion. I believe that a visually appealing way to display the output on the screen is to ensure symmetry in the length of asterisks and description lines. I imagine someone looking at the screen and focusing on symmetrical details. Therefore, the string length should serve as the basis for the calculation. If the description length is an even number, then the formula would be: ((description length − 7) / 2) Placing this result of asterisks on both sides of the string ' QUERY ' ensures balance. If the description length is an odd number, then place: ((description length − 7) / 2)
asterisks on the right side and: (((description length − 7) / 2) + 1) asterisks on the left side. This method does not always result in a perfectly symmetric number of asterisks, but it provides a more visually aligned appearance. At the end of the SQL code, we should also include a line terminator of the same length of the description. The format looks like this: /****************** QUERY *******************/ /* Get information about row-level policies */ SELECT pol.polname, pol.polpermissive, CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END, pg_catalog.pg_get_expr(pol.polqual, pol.polrelid), pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid), CASE pol.polcmd WHEN 'r' THEN 'SELECT' WHEN 'a' THEN 'INSERT' WHEN 'w' THEN 'UPDATE' WHEN 'd' THEN 'DELETE' END AS cmd FROM pg_catalog.pg_policy pol WHERE pol.polrelid = '134384' ORDER BY 1; /********************************************/ Regards, Maiquel.