Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit04f3342

Browse files
committed
In createlang, make dbname optional, not langname, or rather, make
existing code of dbname optional actually work.
1 parentb3d9768 commit04f3342

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

‎doc/src/sgml/ref/createlang.sgml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.21 2001/12/08 03:24:35 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.22 2002/01/03 05:30:03 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -23,8 +23,8 @@ PostgreSQL documentation
2323
<cmdsynopsis>
2424
<command>createlang</command>
2525
<arg rep="repeat"><replaceable>connection-options</replaceable></arg>
26-
<arg><replaceable>langname</replaceable></arg>
27-
<arg choice="plain"><replaceable>dbname</replaceable></arg>
26+
<arg choice="plain"><replaceable>langname</replaceable></arg>
27+
<arg><replaceable>dbname</replaceable></arg>
2828
<sbr>
2929
<command>createlang</command>
3030
<arg rep="repeat"><replaceable>connection-options</replaceable></arg>
@@ -46,9 +46,6 @@ PostgreSQL documentation
4646
<para>
4747
Specifies the name of the procedural programming language to be
4848
defined.
49-
<application>createlang</application> will prompt for
50-
<replaceable class="parameter">langname</replaceable>
51-
if it is not specified on the command line.
5249
</para>
5350
</listitem>
5451
</varlistentry>
@@ -58,6 +55,8 @@ PostgreSQL documentation
5855
<listitem>
5956
<para>
6057
Specifies to which database the language should be added.
58+
The default is to create a database with the same name as the
59+
current system user.
6160
</para>
6261
</listitem>
6362
</varlistentry>

‎src/bin/scripts/createlang.sh

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
# Portions Copyright (c) 1994, Regents of the University of California
99
#
10-
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.31 2001/09/30 22:17:51 momjian Exp $
10+
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.32 2002/01/03 05:30:04 momjian Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -125,7 +125,7 @@ if [ -n "$usage" ]; then
125125
echo"$CMDNAME installs a procedural language into a PostgreSQL database."
126126
echo
127127
echo"Usage:"
128-
echo"$CMDNAME [options][langname]dbname"
128+
echo"$CMDNAME [options] langname [dbname]"
129129
echo
130130
echo"Options:"
131131
echo" -h, --host=HOSTNAME Database server host"
@@ -136,26 +136,23 @@ if [ -n "$usage" ]; then
136136
echo" -L, --pglib=DIRECTORY Find language interpreter file in DIRECTORY"
137137
echo" -l, --list Show a list of currently installed languages"
138138
echo
139-
echo"If 'langname' is not specified, you will be prompted interactively."
140-
echo"A database name must be specified."
141-
echo
142139
echo"Report bugs to <pgsql-bugs@postgresql.org>."
143140
exit 0
144141
fi
145142

146143

147-
# ----------
148-
# Check that we have a database
149-
# ----------
150144
if [-z"$dbname" ];then
151-
echo"$CMDNAME: missing required argument database name"1>&2
152-
echo"Try '$CMDNAME --help' for help."1>&2
153-
exit 1
145+
if ["$PGUSER" ];then
146+
dbname="$PGUSER"
147+
else
148+
dbname=`${PATHNAME}pg_id -u -n`
149+
fi
150+
["$?"-ne 0 ]&&exit 1
154151
fi
155152

156153

157154
# ----------
158-
# List option
155+
# List option, doesn't need langname
159156
# ----------
160157
if ["$list" ];then
161158
sqlcmd="SELECT lanname as\"Name\", lanpltrusted as\"Trusted?\" FROM pg_language WHERE lanispl = TRUE;"
@@ -168,18 +165,19 @@ fi
168165

169166

170167
# ----------
171-
#Check that we have PGLIB
168+
#We can't go any farther without a langname
172169
# ----------
173-
if [-z"$PGLIB" ];then
174-
PGLIB='$libdir'
170+
if [-z"$langname" ];then
171+
echo"$CMDNAME: missing required argument language name"1>&2
172+
echo"Try '$CMDNAME --help' for help."1>&2
173+
exit 1
175174
fi
176175

177176
# ----------
178-
#If not given on the command line, ask for the language
177+
#Check that we have PGLIB
179178
# ----------
180-
if [-z"$langname" ];then
181-
$ECHO_N"Language to install in database$dbname:"$ECHO_C
182-
read langname
179+
if [-z"$PGLIB" ];then
180+
PGLIB='$libdir'
183181
fi
184182

185183
# ----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp