Re: [PATCHES] Warning for missing createlang

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Warning for missing createlang
Date: 2003-09-05 15:57:26
Message-ID: 200309051557.h85FvQw04854@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > Bruce Momjian wrote:
> >>> HINT: Perhaps you need to use 'createlang' to load the language into
> >>> the database, or you mistyped the language name.
>
> > Why not list out the languages we *do* know about, and tell them it's
> > not in the list? Or is that too much work?
>
> Seems like it would clutter the error message without really addressing
> Bruce's concern. I doubt that seeing the list of available languages
> would do much to jog a newbie's memory about needing to run createlang.
>
> We could answer my objection about the hint popping out on misspelled
> language names if the code were to arrange to put out the hint only when
> the language name is one of "plpgsql", "pltcl", "pltclu", etc. This
> would have to use a hard-coded list of loadable language names, since
> by definition looking in pg_language won't help. It would be enough of
> a maintenance PITA that I don't especially want to do it ... but it
> would ensure that the hint is likely to be relevant.

OK, new output is:

test=> create function xx() returns int as '
test'> select 1'
test-> language 'plpgsql';
ERROR: language "plpgsql" does not exist
HINT: You need to use 'createlang' to load the language into the database.
test=> create function xx() returns int as '
test'> select 1'
test-> language 'XXplpgsql';
ERROR: language "xxplpgsql" does not exist

Patch attached.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2003-09-05 16:06:17 Re: Seqscan in MAX(index_column)
Previous Message Czuczy Gergely 2003-09-05 15:57:20 Logging improvements and rehashing

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-09-05 16:13:56 Re: doc patch - linux memory handling
Previous Message Andrew Dunstan 2003-09-05 15:34:17 Re: doc patch - linux memory handling