I wrote:
> Peter Eisentraut <peter.eisentr...@2ndquadrant.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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to