dbcli/pgspecial

\dD's output not matching psql's

igncampa opened this issue · 2 comments

pg_catalog.ltrim((COALESCE((SELECT (' collate ' || c.collname)
FROM pg_catalog.pg_collation AS c,
pg_catalog.pg_type AS bt
WHERE c.oid = t.typcollation
AND bt.oid = t.typbasetype
AND t.typcollation <> bt.typcollation) , '')
|| CASE
WHEN t.typnotnull
THEN ' not null'
ELSE ''
END) || CASE
WHEN t.typdefault IS NOT NULL
THEN(' default ' || t.typdefault)
ELSE ''
END) AS "Modifier",

This code was merged in #50

This is a clever trick to save space when using \dD. Basically it concatenates 3 conditions into a single field.

psql

                        List of domains
 Schema | Name | Type | Collation | Nullable | Default | Check 
--------+------+------+-----------+----------+---------+-------

Collation, Nullable and Default concatenated into Modifier. Each condition is turned into an empty string if nonexistant.

pgcli

+----------+--------+--------+------------+---------+
| Schema   | Name   | Type   | Modifier   | Check   |
|----------+--------+--------+------------+---------|
+----------+--------+--------+------------+---------+

I like it. My concern is that this might not be inherently clear to users actually wanting to check these conditions. Of course, if all of them are not null, it will be obvious.

Do you guys want to keep it or should we mimic psql's output?

I actually prefer what pgcli does. There can be different opinions, of course. But we're not obligated to copy everything psql does, only what makes sense to us.

Alright. Please feel free to close this issue. I don't do it myself just in case you might want to let a discussion build.