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

Commit2fb0ff0

Browse files
committed
Default argument for createdb
Changed EXIT_ON_ERROR to ON_ERROR_STOP in psql
1 parent7528fd2 commit2fb0ff0

File tree

5 files changed

+38
-33
lines changed

5 files changed

+38
-33
lines changed

‎doc/src/sgml/ref/createdb.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.8 1999/12/07 22:41:41 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.9 2000/02/10 20:08:55 petere Exp $
33
Postgres documentation
44
-->
55

@@ -121,6 +121,8 @@ createdb [ <replaceable class="parameter">options</replaceable> ] <replaceable c
121121
<para>
122122
Specifies the name of the database to be created. The name must be
123123
unique among all <productname>PostgreSQL</productname> databases in this installation.
124+
The default is to create a database with the same name as the
125+
current system user.
124126
</para>
125127
</listitem>
126128
</varlistentry>

‎doc/src/sgml/ref/psql-ref.sgml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.23 2000/02/07 23:10:03 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.24 2000/02/10 20:08:55 petere Exp $
33
Postgres documentation
44
-->
55

@@ -1644,24 +1644,6 @@ bar
16441644
</listitem>
16451645
</varlistentry>
16461646

1647-
<varlistentry>
1648-
<term><envar>EXIT_ON_ERROR</envar></term>
1649-
<listitem>
1650-
<para>
1651-
By default, if non-interactive scripts encounter an error, such as a
1652-
malformed <acronym>SQL</acronym> query or internal meta-command,
1653-
processing continues. This is has been the traditional behaviour of
1654-
<application>psql</application>but is often less than desirable. If this variable
1655-
is set, script processing will immediately terminate. If the script was
1656-
called from another script it will terminate in the same fashion.
1657-
If the outermost script was not called from an interactive <application>psql</application>
1658-
session but rather using the <option>-f</option> option, <application>psql</application>
1659-
will return error code 3, to distinguish this case from fatal
1660-
error conditions (error code 1).
1661-
</para>
1662-
</listitem>
1663-
</varlistentry>
1664-
16651647
<varlistentry>
16661648
<term><envar>HISTCONTROL</envar></term>
16671649
<listitem>
@@ -1766,6 +1748,24 @@ bar
17661748
</listitem>
17671749
</varlistentry>
17681750

1751+
<varlistentry>
1752+
<term><envar>ON_ERROR_STOP</envar></term>
1753+
<listitem>
1754+
<para>
1755+
By default, if non-interactive scripts encounter an error, such as a
1756+
malformed <acronym>SQL</acronym> query or internal meta-command,
1757+
processing continues. This is has been the traditional behaviour of
1758+
<application>psql</application> but it is sometimes not desirable. If this variable
1759+
is set, script processing will immediately terminate. If the script was
1760+
called from another script it will terminate in the same fashion.
1761+
If the outermost script was not called from an interactive <application>psql</application>
1762+
session but rather using the <option>-f</option> option, <application>psql</application>
1763+
will return error code 3, to distinguish this case from fatal
1764+
error conditions (error code 1).
1765+
</para>
1766+
</listitem>
1767+
</varlistentry>
1768+
17691769
<varlistentry>
17701770
<term><envar>PORT</envar></term>
17711771
<listitem>
@@ -1886,7 +1886,7 @@ testdb=> <userinput>\set content `sed -e "s/'/\\\\\\'/g" < my_file.txt`</userinp
18861886

18871887
<para>
18881888
Since colons may legally appear in queries, the following rule applies: If the variable
1889-
is not set, the character sequence <quote>colonname</quote> is not changed. In any
1889+
is not set, the character sequence <quote>colon+name</quote> is not changed. In any
18901890
case you can escape a colon with a backslash to protect it from interpretation.
18911891
(The colon syntax for variables is standard <acronym>SQL</acronym> for embedded
18921892
query languages, such as <application>ecpg</application>. The colon syntax for
@@ -1987,8 +1987,8 @@ testdb=> <userinput>\set content `sed -e "s/'/\\\\\\'/g" < my_file.txt`</userinp
19871987
<varlistentry>
19881988
<term><literal>%:</literal><replaceable class="parameter">name</replaceable><literal>:</literal></term>
19891989
<listitem><para>
1990-
The value of the <application>psql</application>,<quote>magic</quote>, or environment
1991-
variable <replaceable class="parameter">name</replaceable>. See the section
1990+
The value of the <application>psql</application>,variable <replaceable
1991+
class="parameter">name</replaceable>. See the section
19921992
<quote><xref linkend="APP-PSQL-variables" endterm="APP-PSQL-variables-title"></quote>
19931993
for details.</para>
19941994
</listitem>
@@ -2024,7 +2024,7 @@ testdb=> <userinput>\set content `sed -e "s/'/\\\\\\'/g" < my_file.txt`</userinp
20242024
<application>psql</application> returns 0 to the shell if it finished normally,
20252025
1 if a fatal error of its own (out of memory, file not found) occurs, 2 if the
20262026
connection to the backend went bad and the session is not interactive, and 3 if
2027-
an error occurred in a script and the variable <envar>EXIT_ON_ERROR</envar> was
2027+
an error occurred in a script and the variable <envar>ON_ERROR_STOP</envar> was
20282028
set.
20292029
</para>
20302030

‎src/bin/psql/help.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.16 2000/02/07 23:10:06 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.17 2000/02/10 20:08:56 petere Exp $
77
*/
88
#include<c.h>
99
#include"help.h"
@@ -54,7 +54,7 @@ usage(void)
5454
if (!user)
5555
{
5656
#ifndefWIN32
57-
pw=getpwuid(getuid());
57+
pw=getpwuid(geteuid());
5858
if (pw)
5959
user=pw->pw_name;
6060
else

‎src/bin/psql/mainloop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.17 2000/02/07 23:10:06 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.18 2000/02/10 20:08:56 petere Exp $
77
*/
88
#include<c.h>
99
#include"mainloop.h"
@@ -138,7 +138,7 @@ MainLoop(FILE *source)
138138

139139

140140
/* Setting this will not have effect until next line. */
141-
die_on_error=GetVariableBool(pset.vars,"EXIT_ON_ERROR");
141+
die_on_error=GetVariableBool(pset.vars,"ON_ERROR_STOP");
142142

143143
/*
144144
* query_buf holds query already accumulated. line is the

‎src/bin/scripts/createdb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
#
1313
# IDENTIFICATION
14-
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.7 2000/01/19 20:08:35 petere Exp $
14+
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.8 2000/02/10 20:08:58 petere Exp $
1515
#
1616
#-------------------------------------------------------------------------
1717

@@ -126,7 +126,7 @@ fi
126126

127127
if [-n"$MB" ]
128128
then
129-
mbcode=`pg_encoding"$MB"`
129+
mbcode=`${PATHNAME}pg_encoding"$MB"`
130130
if [-z"$mbcode" ]
131131
then
132132
echo"$CMDNAME:\"$MB\" is not a valid encoding name"
@@ -135,9 +135,12 @@ then
135135
fi
136136

137137
if [-z"$dbname" ];then
138-
echo"$CMDNAME: missing required argument database name"
139-
echo"Try -? for help."
140-
exit 1
138+
if ["$PGUSER" ];then
139+
dbname=$PGUSER
140+
else
141+
dbname=`${PATHNAME}pg_id -u -n`
142+
fi
143+
[$?-ne 0 ]&&exit 1
141144
fi
142145

143146

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp