version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
CREATEDB |
|
|
2 |
!!!CREATEDB |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
USAGE |
|
|
7 |
---- |
|
|
8 |
!!NAME |
|
|
9 |
|
|
|
10 |
|
|
|
11 |
createdb - create a new PostgreSQL database |
|
|
12 |
!!SYNOPSIS |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
__createdb__ [[ ''options''... ] [[ ''dbname'' ] [[ |
|
|
16 |
''description'' ] |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__INPUTS__ |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
__-h, --host__ ''host'' |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
Specifies the host name of the machine on which the server |
|
|
26 |
is running. If host begins with a slash, it is used as the |
|
|
27 |
directory for the Unix domain socket. |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
__-p, --port__ ''port'' |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
Specifies the Internet TCP/IP port or the local Unix domain |
|
|
34 |
socket file extension on which the server is listening for |
|
|
35 |
connections. |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
__-U, --username__ ''username'' |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
User name to connect as |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
__-W, --password__ |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
Force password prompt. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
__-e, --echo__ |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
Echo the queries that __createdb__ generates and sends to |
|
|
54 |
the server. |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
__-q, --quiet__ |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
Do not display a response. |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
__-D, --location__ ''datadir'' |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
Specifies the alternative location for the database. See |
|
|
67 |
also initlocation(1). |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
__-T, --template__ ''template'' |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
Specifies the template database from which to build this |
|
|
74 |
database. |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
__-E, --encoding__ ''encoding'' |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
Specifies the character encoding scheme to be used in this |
|
|
81 |
database. |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
''dbname'' |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
Specifies the name of the database to be created. The name |
|
|
88 |
must be unique among all PostgreSQL databases in this |
|
|
89 |
installation. The default is to create a database with the |
|
|
90 |
same name as the current system user. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
''description'' |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
This optionally specifies a comment to be associated with |
|
|
97 |
the newly created database. |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
The options -h, -p, -U, -W, and -e are passed on literally |
|
|
101 |
to psql(1). The options -D, -T, and -E are converted |
|
|
102 |
into options for the underlying SQL command CREATE DATABASE |
|
|
103 |
[[__create_database__(l)]; see there for more information |
|
|
104 |
about them. |
|
|
105 |
|
|
|
106 |
|
|
|
107 |
__OUTPUTS__ |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
__CREATE DATABASE__ |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
The database was successfully created. |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
__createdb: Database creation failed.__ |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
(Says it all.) |
|
|
120 |
|
|
|
121 |
|
|
|
122 |
__createdb: Comment creation failed. (Database was |
|
|
123 |
created.)__ |
|
|
124 |
|
|
|
125 |
|
|
|
126 |
The comment/description for the database could not be |
|
|
127 |
created. The database itself will have been created already. |
|
|
128 |
You can use the SQL command __COMMENT ON DATABASE__ to |
|
|
129 |
create the comment later on. |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
If there is an error condition, the backend error message |
|
|
133 |
will be displayed. See CREATE DATABASE |
|
|
134 |
[[__create_database__(l)] and psql(1) for |
|
|
135 |
possibilities. |
|
|
136 |
!!DESCRIPTION |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
__createdb__ creates a new PostgreSQL database. The user |
|
|
140 |
who executes this command becomes the database |
|
|
141 |
owner. |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
__createdb__ is a shell script wrapper around the SQL |
|
|
145 |
command CREATE DATABASE [[__create_database__(l)] via the |
|
|
146 |
PostgreSQL interactive terminal psql(1). Thus, there |
|
|
147 |
is nothing special about creating databases via this or |
|
|
148 |
other methods. This means that the __psql__ program must |
|
|
149 |
be found by the script and that a database server must be |
|
|
150 |
running at the targeted port. Also, any default settings and |
|
|
151 |
environment variables available to __psql__ and the |
|
|
152 |
__libpq__ front-end library will apply. |
|
|
153 |
!!USAGE |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
To create the database demo using the default database |
|
|
157 |
server: |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
$ __createdb demo |
|
|
161 |
__CREATE DATABASE |
|
|
162 |
The response is the same as you would have gotten from running the __CREATE DATABASE__ SQL command. |
|
|
163 |
|
|
|
164 |
|
|
|
165 |
To create the database demo using the server on host eden, |
|
|
166 |
port 5000, using the LATIN1 encoding scheme with a look at |
|
|
167 |
the underlying query: |
|
|
168 |
|
|
|
169 |
|
|
|
170 |
$ __createdb -p 5000 -h eden -E LATIN1 -e demo |
|
|
171 |
__CREATE DATABASE |
|
|
172 |
__ |
|
|
173 |
---- |