Em dom., 10 de nov. de 2019 às 18:29, Justin Pryzby <pry...@telsasoft.com> escreveu: > > We have some very wide tables (historically, up to 1600 columns ; this is > improved now, but sometimes still several hundred, with numerous pages output > to psql pager). Is is reasonable to suggest adding a psql command to show a > table's definition, without all the columns listed? > It seems a good idea. However, I'm afraid adding a second argument could limit our capabilities to match/suppress other table properties in the future. For example, I think psql might have a way to omit indexes, FKs, partitions, some column properties, or even show GRANTs for that table. I don't have a concrete plan at the moment but maybe someone else already thought about it.
> Or limit display to matching columns ? That's more general than the above > functionality, if "empty string" is taken to mean "show no columns", like \d > table "" or \d table *id or \d table ???? > > Attached minimal patch for the latter. > > postgres=# \d pg_attribute "" > Table "pg_catalog.pg_attribute" > Column | Type | Collation | Nullable | Default > --------+------+-----------+----------+--------- > Indexes: > "pg_attribute_relid_attnam_index" UNIQUE, btree (attrelid, attname) > "pg_attribute_relid_attnum_index" UNIQUE, btree (attrelid, attnum) > The problem with your proposal is that I can't differentiate a complete output from another suppress-some-columns output if you don't provide the meta-command. I think you should explicitly show that some columns were suppressed (something like "... suppressed columns..." after the list of matched columns). If you don't, it could lead to confusion while reporting table description. -- Euler Taveira Timbira - http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento