Re: make createlang match docs

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Marko Kreen <marko(at)l-t(dot)ee>
Cc: Thomas Lockhart <lockhart(at)fourpalms(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: make createlang match docs
Date: 2002-01-03 05:29:27
Message-ID: 200201030529.g035TRs09996@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Marko Kreen wrote:
> On Thu, Dec 13, 2001 at 05:47:37AM +0000, Thomas Lockhart wrote:
> > > > > * make createlang match docs: "createlang dbname" did not work.
> > > > What is the meaning of that command?
> > > You give a database to act on, like to other scripts, then it
> > > asks what language to install.
> >
> > But since it respects PGHOST and should use a database name the same as
> > your user name, that usage is degenerate with "createlang newlanguage".
> > Isn't it? Or shouldn't it be?
>
> Well, it does not respect PGDATABASE nor uses username as
> default - and making it do so changes the current behaviour...
>
> Although I think too 'createlang langname' would be saner.

I was going to add this to TODO:

Change 'createlang [langname] dbname' to 'createlang langname [dbname]'

However, when I started to look at the createlang script, I saw:

if [ "$list" != "t" ]
then langname="$1"
if [ "$2" ]
then
shift
dbname="$1"
fi
else dbname="$1"
fi

which said that dbname was already behaving as optional, even though
there was code to handle a missing langname.

Rather than change the script to make langname optional, I have fixed
the script to work the way everyone wants it to work, namely dbname is
now optional. I grabbed the dbname default code from createdb.

Applied to CVS with doc updates. Patch attached.

Also, can someone explain why we have a createlang.sh? Makefile shows:

createlang: createlang.sh
cp $< $@
chmod a+x $@

Not much doing there.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Attachment Content-Type Size
unknown_filename text/plain 4.9 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-01-03 05:33:04 Re: make createlang match docs
Previous Message Tom Lane 2002-01-02 22:10:29 Re: [SQL] Unpredictable text -> date implicit casting behaviour/to_date bug