Re: psql: Add \dL to show languages

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Fernando Ike <fike(at)midstorm(dot)org>
Subject: Re: psql: Add \dL to show languages
Date: 2011-01-16 01:26:24
Message-ID: 1295141184.17167.3.camel@jansson
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Josh,

Here is my review of this patch for the commitfest.

Review of

Contents and Purpose

This patch adds the \dL command in psql to list the procedual languages.

To me this seems like a useful addition to the commands in psql and \dL
is also a quite sane name for it which follows the established

Documentation of the new command is included and looks good.

Runing it

Patch did not apply cleanly against HEAD so fixed it.

I tested the comamnds, \dL, \dLS, \dL+, \dLS+ and they wroked as I
expected. Support for patterns worked too and while not that useful it
was not much code either. The psql completion worked fine too.

Some things I noticed when using it though.

I do not like the use of parentheses in the usage description "list
(procedural) languages". Why not have it simply as "list procedural

Should we include a column in \dL+ for the laninline function (DO


Quite irrelevant to this patch. :)


In general the code looks good and follows conventions except for some
whitesapce errors that I cleaned up.

* Trailing whitespace in src/bin/psql/describe.c.
* Incorrect indenation, spaces vs tabs in psql/describe.c and
* Removed empty line after return in listLanguages to match other

The comment for the function is not that descriptive but it is enough
and fits with the other functions.

Another things is that generated SQL needs its formatting fixed up in my
oppinion. I recommend looking at the query built by \dL by using psql
-E. Here is an example how the query looks for \dL+

SELECT l.lanname AS "Procedural Language",
pg_catalog.pg_get_userbyid(l.lanowner) as "Owner",
l.lanpltrusted AS "Trusted",
l.lanplcallfoid::regprocedure AS "Call Handler",
l.lanvalidator::regprocedure AS "Validator",
NOT l.lanispl AS "System Language",
pg_catalog.array_to_string(l.lanacl, E'\n') AS "Access privileges" FROM pg_catalog.pg_language l


The patch looks useful, worked, and there were no bugs obvious to me.
The code also looks good and in line with other functions doing similar
things. There are just some small issues that I think should be resolved
before committing it: laninline, format of the built query and the usage

Attached is a version that applies to current HEAD and with whitespace


Attachment Content-Type Size
psql_languages.v6.patch text/x-patch 6.5 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2011-01-16 01:33:10 Re: Streaming base backups
Previous Message Jan Urbański 2011-01-16 00:55:19 review: FDW API