Re: Showing parallel status in \df+

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Masao Fujii <masao(dot)fujii(at)gmail(dot)com>
Subject: Re: Showing parallel status in \df+
Date: 2016-08-24 14:24:22
Message-ID: 15880.1472048662@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
>> What does it do if you are displaying more than one function?

> It prints more than one footer. It's very much like the way that, say,
> rules are printed for tables by \d.

Or to be concrete: instead of

regression=# \df+ foo*
List of functions
Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Access privileges | Language | Source code | Description
--------+---------+------------------+---------------------+--------+------------+----------+----------+----------+-------------------+----------+--------------------------------------------------------------------+-------------
public | foo1 | integer | integer | normal | volatile | unsafe | postgres | invoker | | plpgsql | +|
| | | | | | | | | | | begin +|
| | | | | | | | | | | return $1 + 1; +|
| | | | | | | | | | | end +|
| | | | | | | | | | | |
public | foo2 | integer | integer | normal | volatile | unsafe | postgres | invoker | | sql | select $1 + 2 |
public | footest | void | | normal | volatile | unsafe | postgres | invoker | | plpgsql | +|
| | | | | | | | | | | -- override the global +|
| | | | | | | | | | | #print_strict_params on +|
| | | | | | | | | | | declare +|
| | | | | | | | | | | x record; +|
| | | | | | | | | | | p1 int := 2; +|
| | | | | | | | | | | p3 text := 'foo'; +|
| | | | | | | | | | | begin +|
| | | | | | | | | | | -- too many rows +|
| | | | | | | | | | | select * from foo where f1 > p1 or f1::text = p3 into strict x;+|
| | | | | | | | | | | raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +|
| | | | | | | | | | | end |
(3 rows)

you get

regression=# \df+ foo*
List of functions
Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Access privileges | Language | Internal name | Description
--------+---------+------------------+---------------------+--------+------------+----------+----------+----------+-------------------+----------+---------------+-------------
public | foo1 | integer | integer | normal | volatile | unsafe | postgres | invoker | | plpgsql | |
public | foo2 | integer | integer | normal | volatile | unsafe | postgres | invoker | | sql | |
public | footest | void | | normal | volatile | unsafe | postgres | invoker | | plpgsql | |
Source code of function public.foo1(integer):

begin
return $1 + 1;
end

Source code of function public.foo2(integer):
select $1 + 2
Source code of function public.footest():

-- override the global
#print_strict_params on
declare
x record;
p1 int := 2;
p3 text := 'foo';
begin
-- too many rows
select * from foo where f1 > p1 or f1::text = p3 into strict x;
raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2;
end

C functions are still compact, and they're more sanely labeled too:

regression=# \df+ sin*
List of functions
Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Access privileges | Language | Internal name | Description
------------+------+------------------+---------------------+--------+------------+----------+----------+----------+-------------------+----------+---------------+---------------
pg_catalog | sin | double precision | double precision | normal | immutable | safe | postgres | invoker | | internal | dsin | sine
pg_catalog | sind | double precision | double precision | normal | immutable | safe | postgres | invoker | | internal | dsind | sine, degrees
(2 rows)

Admittedly, this is not a huge improvement when working in expanded
display mode, but in normal mode I think it's the difference between a
usable display and a useless one.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Emre Hasegeli 2016-08-24 14:47:19 Re: [PATCH] Alter or rename enum value
Previous Message Stephen Frost 2016-08-24 14:15:59 Re: pg_dump with tables created in schemas created by extensions