January 8th, 2009 by depesz | Tags: , , | 2 comments »
Did it help? If yes - maybe you can help me? Donate BTC to 19zPa5diT2LZqGtTi8f8bfApLn8rw9zBHx

On 6th of January Bruce Momjian committed patch by Greg Sabino Mulane, which fixes one of a very long standing annoyances in PostgreSQL – removes system objects from \dX commands in psql.

Commit message:

This makes all the \dX commands (most importantly to most: \df) work
like \dt does, in that it requires a \dXS to see system items.

Example with \df is the most appropriate, as it usually contains a lot of items.

I've been many times in position when I couldn't remember name of function that I wrote, and loaded to database some time ago. Of course I could check documentation, but it would be cool just to get it's name from \df.

But – until 8.3, \df shows all function. Including system, built-in ones. Effect: 1893 functions in my test database.

Of course I could add “public." to \df:

# \df public.

But it's definitely not intuitive – given the way \d and \dt works.

Now, with this new patch, \df will show only user-added function:

# \df
List of functions
Schema | Name | Result data type | Argument data types
--------+------+------------------+-----------------------------------------------------------------------
public | test | SETOF record | from_i integer, to_i integer, OUT numerical integer, OUT textual text
(1 row)

To get previous effect of \df you just add S – like this:

# \dfS
...
(1914 rows)

Same thing works with tables (of course), aggregates, domains, conversions, indexes, sequences, operators, types and views. Cool :-)

  1. 2 comments

  2. # gregj
    Jan 8, 2009

    :D

  3. Jan 8, 2009

    finally :-)

Leave a comment