Re: proposal psql \gdesc

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal psql \gdesc
Date: 2017-05-03 06:56:12
Message-ID: CAFj8pRDhb30d-Pi7-9oGs4Zs2_UeOYA2u77Ss2L4+KrfBDS7PQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-04-28 6:08 GMT+02:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

> Hi
>
> Sometimes I have to solve the result types of some query. It is invisible
> in psql. You have to materialize table or you have to create view. Now,
> when we can enhance \g command, we can introduce query describing
>
> some like
>
> select a, b from foo
> \gdesc
>
> | type | length | collation | ....
> ------------------------------------------------
> a | varchar | 30 |
> b | numeric | 20 |
>
>
here is the patch. It is based on PQdescribePrepared result.

postgres=# select * from pg_proc \gdesc
┌─────────────────┬──────────────┐
│ Name │ Type │
╞═════════════════╪══════════════╡
│ proname │ name │
│ pronamespace │ oid │
│ proowner │ oid │
│ prolang │ oid │
│ procost │ real │
│ prorows │ real │
│ provariadic │ oid │
│ protransform │ regproc │
│ proisagg │ boolean │
│ proiswindow │ boolean │
│ prosecdef │ boolean │
│ proleakproof │ boolean │
│ proisstrict │ boolean │
│ proretset │ boolean │
│ provolatile │ "char" │
│ proparallel │ "char" │
│ pronargs │ smallint │
│ pronargdefaults │ smallint │
│ prorettype │ oid │
│ proargtypes │ oidvector │
│ proallargtypes │ oid[] │
│ proargmodes │ "char"[] │
│ proargnames │ text[] │
│ proargdefaults │ pg_node_tree │
│ protrftypes │ oid[] │
│ prosrc │ text │
│ probin │ text │
│ proconfig │ text[] │
│ proacl │ aclitem[] │
└─────────────────┴──────────────┘
(29 rows)

> What do you think about this idea?
>
> Regards
>
> Pavel
>

Attachment Content-Type Size
psql-gdesc.patch text/x-patch 6.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-05-03 07:39:00 Re: Concurrent ALTER SEQUENCE RESTART Regression
Previous Message Petr Jelinek 2017-05-03 06:44:00 Re: Time based lag tracking for logical replication