Example usage
-select dblink_connect('dbname=template1');
+select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
(1 row)
-select dblink_connect('myconn','dbname=template1');
+select dblink_connect('myconn','dbname=postgres');
dblink_connect
----------------
OK
Example usage
-test=# select dblink_connect('dbname=template1');
+test=# select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
Example usage
-test=# select dblink_connect('dbname=template1');
+test=# select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
Example usage
-test=# select dblink_connect('dbname=template1');
+test=# select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
Example usage
-test=# select dblink_current_query() from (select dblink('dbname=template1','select oid, proname from pg_proc where proname = ''byteacat''') as f1) as t1;
+test=# select dblink_current_query() from (select dblink('dbname=postgres','select oid, proname from pg_proc where proname = ''byteacat''') as f1) as t1;
dblink_current_query
-----------------------------------------------------------------------------------------------------------------------------------------------------
- select dblink_current_query() from (select dblink('dbname=template1','select oid, proname from pg_proc where proname = ''byteacat''') as f1) as t1;
+ select dblink_current_query() from (select dblink('dbname=postgres','select oid, proname from pg_proc where proname = ''byteacat''') as f1) as t1;
(1 row)
==================================================================
Example usage
-select * from dblink('dbname=template1','select proname, prosrc from pg_proc')
+select * from dblink('dbname=postgres','select proname, prosrc from pg_proc')
as t1(proname name, prosrc text) where proname like 'bytea%';
proname | prosrc
------------+------------
byteaout | byteaout
(12 rows)
-select dblink_connect('dbname=template1');
+select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
create view myremote_pg_proc as
select *
- from dblink('dbname=template1','select proname, prosrc from pg_proc')
+ from dblink('dbname=postgres','select proname, prosrc from pg_proc')
as t1(proname name, prosrc text);
Then you can simply write:
if (my_opts->dbname == NULL)
{
- my_opts->dbname = "template1";
+ my_opts->dbname = "postgres";
my_opts->nodb = true;
}
pgconn = sql_conn(my_opts);
#!/bin/sh
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
-# Package : reindexdb Version : $Revision: 1.5 $
+# Package : reindexdb Version : $Revision: 1.6 $
# Date : 05/08/2002 Author : Shaun Thomas
# Req : psql, sh, perl, sed Type : Utility
#
# connect to. That's the list we'll be using. It's also why it's
# a good idea for this to be run as a super-user.
sql='SELECT datname FROM pg_database WHERE datallowconn'
- dbname=`$PSQL $PSQLOPT -q -t -A -d template1 -c "$sql"`
+ dbname=`$PSQL $PSQLOPT -q -t -A -d postgres -c "$sql"`
# Ok, if it's not all databases, make sure at least one database is
# specified before continuing.
boundaries. For example, it adds an extra digit to the lower
boundary if the resulting interval includes a power of ten:
- template1=> select '10(+-)1'::seg as seg;
+ postgres=> select '10(+-)1'::seg as seg;
seg
---------
9.0 .. 11 -- should be: 9 .. 11
<!--
-$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.66 2005/06/20 13:52:17 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.67 2005/06/21 04:02:29 tgl Exp $
-->
<chapter id="backup">
<title>Backup and Restore</title>
</synopsis>
The resulting dump can be restored with <application>psql</>:
<synopsis>
-psql -f <replaceable class="parameter">infile</replaceable> template1
+psql -f <replaceable class="parameter">infile</replaceable> postgres
</synopsis>
(Actually, you can specify any existing database name to start from,
- but if you are reloading in an empty cluster then <literal>template1</>
- is the only available choice.) It is always necessary to have
+ but if you are reloading in an empty cluster then <literal>postgres</>
+ should generally be used.) It is always necessary to have
database superuser access when restoring a <application>pg_dumpall</>
dump, as that is required to restore the user and group information.
</para>
in parallel, on different ports. Then you can use something like
<programlisting>
-pg_dumpall -p 5432 | psql -d template1 -p 6543
+pg_dumpall -p 5432 | psql -d postgres -p 6543
</programlisting>
to transfer your data. Or use an intermediate file if you want.
gmake install
initdb -D /usr/local/pgsql/data
postmaster -D /usr/local/pgsql/data
-psql -f backup template1
+psql -f backup postgres
</programlisting>
See <xref linkend="runtime"> about ways to start and stop the
-<!-- $PostgreSQL: pgsql/doc/src/sgml/charset.sgml,v 2.72 2005/04/16 16:50:01 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/charset.sgml,v 2.73 2005/06/21 04:02:29 tgl Exp $ -->
<chapter id="charset">
<title>Localization</>
euc_kr | t-ishii | EUC_KR
euc_tw | t-ishii | EUC_TW
mule_internal | t-ishii | MULE_INTERNAL
+ postgres | t-ishii | EUC_JP
regression | t-ishii | SQL_ASCII
template1 | t-ishii | EUC_JP
test | t-ishii | EUC_JP
<!--
-$PostgreSQL: pgsql/doc/src/sgml/client-auth.sgml,v 1.80 2005/06/04 20:42:41 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/client-auth.sgml,v 1.81 2005/06/21 04:02:29 tgl Exp $
-->
<chapter id="client-authentication">
host all all 127.0.0.1 255.255.255.255 trust
# Allow any user from any host with IP address 192.168.93.x to connect
-# to database "template1" as the same user name that ident reports for
+# to database "postgres" as the same user name that ident reports for
# the connection (typically the Unix user name).
#
# TYPE DATABASE USER CIDR-ADDRESS METHOD
-host template1 all 192.168.93.0/24 ident sameuser
+host postgres all 192.168.93.0/24 ident sameuser
# Allow a user from host 192.168.12.10 to connect to database
-# "template1" if the user's password is correctly supplied.
+# "postgres" if the user's password is correctly supplied.
#
# TYPE DATABASE USER CIDR-ADDRESS METHOD
-host template1 all 192.168.12.10/32 md5
+host postgres all 192.168.12.10/32 md5
# In the absence of preceding "host" lines, these two lines will
# reject all connection from 192.168.54.1 (since that entry will be
-<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.235 2005/06/12 15:51:50 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.236 2005/06/21 04:02:29 tgl Exp $ -->
<chapter id="installation">
<title><![%standalone-include[<productname>PostgreSQL</>]]>
</programlisting>
Finally, restore your data with
<screen>
-<userinput>/usr/local/pgsql/bin/psql -d template1 -f <replaceable>outputfile</></userinput>
+<userinput>/usr/local/pgsql/bin/psql -d postgres -f <replaceable>outputfile</></userinput>
</screen>
using the <emphasis>new</> <application>psql</>.
</para>
<!--
-$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.185 2005/06/12 00:00:20 neilc Exp $
+$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.186 2005/06/21 04:02:29 tgl Exp $
-->
<chapter id="libpq">
/*
* If the user supplies a parameter on the command line, use it as
- * the conninfo string; otherwise default to setting dbname=template1
+ * the conninfo string; otherwise default to setting dbname=postgres
* and using environment variables or defaults for all other connection
* parameters.
*/
if (argc > 1)
conninfo = argv[1];
else
- conninfo = "dbname = template1";
+ conninfo = "dbname = postgres";
/* Make a connection to the database */
conn = PQconnectdb(conninfo);
/*
* If the user supplies a parameter on the command line, use it as
- * the conninfo string; otherwise default to setting dbname=template1
+ * the conninfo string; otherwise default to setting dbname=postgres
* and using environment variables or defaults for all other connection
* parameters.
*/
if (argc > 1)
conninfo = argv[1];
else
- conninfo = "dbname = template1";
+ conninfo = "dbname = postgres";
/* Make a connection to the database */
conn = PQconnectdb(conninfo);
/*
* If the user supplies a parameter on the command line, use it as
- * the conninfo string; otherwise default to setting dbname=template1
+ * the conninfo string; otherwise default to setting dbname=postgres
* and using environment variables or defaults for all other connection
* parameters.
*/
if (argc > 1)
conninfo = argv[1];
else
- conninfo = "dbname = template1";
+ conninfo = "dbname = postgres";
/* Make a connection to the database */
conn = PQconnectdb(conninfo);
<!--
-$PostgreSQL: pgsql/doc/src/sgml/manage-ag.sgml,v 2.41 2005/06/13 02:40:04 neilc Exp $
+$PostgreSQL: pgsql/doc/src/sgml/manage-ag.sgml,v 2.42 2005/06/21 04:02:30 tgl Exp $
-->
<chapter id="managing-databases">
<command>initdb</> command when the data storage area is
initialized. (See <xref linkend="creating-cluster">.) This
database is called
- <literal>template1</>.<indexterm><primary>template1</></> So to
- create the first <quote>real</> database you can connect to
- <literal>template1</>.
+ <literal>postgres</>.<indexterm><primary>postgres</></> So to
+ create the first <quote>ordinary</> database you can connect to
+ <literal>postgres</>.
</para>
<para>
- The name <literal>template1</literal> is no accident: when a new
- database is created, the template database is essentially cloned.
+ A second database,
+ <literal>template1</literal>,<indexterm><primary>template1</></>
+ is also created by
+ <command>initdb</>. Whenever a new database is created within the
+ cluster, <literal>template1</literal> is essentially cloned.
This means that any changes you make in <literal>template1</> are
- propagated to all subsequently created databases. This implies that
- you should not use the template database for real work, but when
+ propagated to all subsequently created databases. Therefore it is
+ unwise to use <literal>template1</> for real work, but when
used judiciously this feature can be convenient. More details
appear in <xref linkend="manage-ag-templatedbs">.
</para>
createdb <replaceable class="parameter">dbname</replaceable>
</synopsis>
- <command>createdb</> does no magic. It connects to the <literal>template1</>
+ <command>createdb</> does no magic. It connects to the <literal>postgres</>
database and issues the <command>CREATE DATABASE</> command,
exactly as described above.
The <xref linkend="app-createdb"> reference page contains the invocation
<para>
<literal>template1</> and <literal>template0</> do not have any special
status beyond the fact that the name <literal>template1</> is the default
- source database name for <command>CREATE DATABASE</> and the default
- database-to-connect-to for various programs such as <command>createdb</>.
+ source database name for <command>CREATE DATABASE</>.
For example, one could drop <literal>template1</> and recreate it from
<literal>template0</> without any ill effects. This course of action
might be advisable if one has carelessly added a bunch of junk in
<literal>template1</>.
</para>
+
+ <para>
+ The <literal>postgres</> database is also created when a database
+ cluster is initialized. This database is meant as a default database for
+ users and applications to connect to. It is simply a copy of
+ <literal>template1</> and may be dropped and recreated if required.
+ </para>
</note>
</sect1>
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/createlang.sgml,v 1.34 2005/05/29 03:32:18 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/createlang.sgml,v 1.35 2005/06/21 04:02:31 tgl Exp $
PostgreSQL documentation
-->
<screen>
<prompt>$ </prompt><userinput>createlang pltcl template1</userinput>
</screen>
+ Note that installing the language into <literal>template1</literal>
+ will cause it to be automatically installed into subsequently-created
+ databases as well.
</para>
</refsect1>
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.19 2003/11/29 19:51:38 pgsql Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.20 2005/06/21 04:02:31 tgl Exp $
PostgreSQL documentation
-->
catalog entries for the database and deletes the directory
containing the data. It can only be executed by the database owner.
Also, it cannot be executed while you or anyone else are connected
- to the target database. (Connect to <literal>template1</literal> or any
+ to the target database. (Connect to <literal>postgres</literal> or any
other database to issue this command.)
</para>
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/initdb.sgml,v 1.34 2005/02/22 02:54:19 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/initdb.sgml,v 1.35 2005/06/21 04:02:31 tgl Exp $
PostgreSQL documentation
-->
which the database data will live, generating the shared catalog
tables (tables that belong to the whole cluster rather than to any
particular database), and creating the <literal>template1</literal>
- database. When you later create a new database, everything in the
- <literal>template1</literal> database is copied. It contains catalog
- tables containing things like built-in data types.
+ and <literal>postgres</literal> databases. When you later create a
+ new database, everything in the <literal>template1</literal> database is
+ copied. (Therefore, anything installed in <literal>template1</literal>
+ is automatically copied into each database created later.)
+ The <literal>postgres</literal> database is a default database meant
+ for use by users, utilities and third party applications.
</para>
<para>
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.49 2005/05/29 03:32:18 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.50 2005/06/21 04:02:31 tgl Exp $
PostgreSQL documentation
-->
<para>
To reload this database use, for example:
<screen>
-<prompt>$</prompt> <userinput>psql -f db.out template1</userinput>
+<prompt>$</prompt> <userinput>psql -f db.out postgres</userinput>
</screen>
(It is not important to which database you connect here since the
script file created by <application>pg_dumpall</application> will
<!--
-$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.329 2005/06/17 22:32:42 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.330 2005/06/21 04:02:30 tgl Exp $
-->
<chapter Id="runtime">
(<acronym>SQL</acronym> uses the term catalog cluster.) A
database cluster is a collection of databases that is managed by a
single instance of a running database server. After initialization, a
- database cluster will contain a database named
- <literal>template1</literal>. As the name suggests, this will be used
+ database cluster will contain a database named <literal>postgres</literal>,
+ which is meant as a default database for use by utilities, users and third
+ party applications. The database server itself does not require the
+ <literal>postgres</literal> database to exist, but many external utility
+ programs assume it exists. Another database created within each cluster
+ during initialization is called
+ <literal>template1</literal>. As the name suggests, this will be used
as a template for subsequently created databases; it should not be
used for actual work. (See <xref linkend="managing-databases"> for
information about creating new databases within a cluster.)
to connect to. In order to connect to the database server using
this tunnel, you connect to port 3333 on the local machine:
<programlisting>
-psql -h localhost -p 3333 template1
+psql -h localhost -p 3333 postgres
</programlisting>
To the database server it will then look as though you are really
user <literal>joe@foo.com</literal> and it will use whatever
<!--
-$PostgreSQL: pgsql/doc/src/sgml/start.sgml,v 1.38 2005/01/08 01:44:08 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/start.sgml,v 1.39 2005/06/21 04:02:30 tgl Exp $
-->
<chapter id="tutorial-start">
<para>
Another response could be this:
<screen>
-createdb: could not connect to database template1: could not connect to server:
+createdb: could not connect to database postgres: could not connect to server:
No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
<para>
Another response could be this:
<screen>
-createdb: could not connect to database template1: FATAL: user "joe" does not
+createdb: could not connect to database postgres: FATAL: user "joe" does not
exist
</screen>
where your own login name is mentioned. This will happen if the
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.159 2005/06/06 20:22:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.160 2005/06/21 04:02:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
DefElem *dencoding = NULL;
char *dbname = stmt->dbname;
char *dbowner = NULL;
- char *dbtemplate = NULL;
+ const char *dbtemplate = NULL;
int encoding = -1;
#ifndef WIN32
*
* To create the database cluster, we create the directory that contains
* all its data, create the files that hold the global tables, create
- * a few other control files for it, and create two databases: the
- * template0 and template1 databases.
+ * a few other control files for it, and create three databases: the
+ * template databases "template0" and "template1", and a default user
+ * database "postgres".
*
* The template databases are ordinary PostgreSQL databases. template0
* is never supposed to change after initdb, whereas template1 can be
* changed to add site-local standard data. Either one can be copied
* to produce a new database.
*
+ * For largely-historical reasons, the template1 database is the one built
+ * by the basic bootstrap process. After it is complete, template0 and
+ * the default database, postgres, are made just by copying template1.
+ *
* To create template1, we run the postgres (backend) program in bootstrap
* mode and feed it data from the postgres.bki library file. After this
* initial bootstrap phase, some additional stuff is created by normal
* just embedded into this program (yeah, it's ugly), but larger chunks
* are taken from script files.
*
- * template0 is made just by copying the completed template1.
*
* Note:
* The program has some memory leakage - it isn't worth cleaning it up.
*
- *
* This is a C implementation of the previous shell script for setting up a
* PostgreSQL cluster location, and should be highly compatible with it.
* author of C translation: Andrew Dunstan mailto:andrew@dunslane.net
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.84 2005/06/17 22:32:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.85 2005/06/21 04:02:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static void setup_schema(void);
static void vacuum_db(void);
static void make_template0(void);
+static void make_postgres(void);
static void trapsig(int signum);
static void check_ok(void);
static char *escape_quotes(const char *src);
* We use the OID of template0 to determine lastsysoid
*/
"UPDATE pg_database SET datlastsysoid = "
- " (SELECT oid::int4 - 1 FROM pg_database "
+ " (SELECT oid FROM pg_database "
" WHERE datname = 'template0');\n",
/*
check_ok();
}
+/*
+ * copy template1 to postgres
+ */
+static void
+make_postgres(void)
+{
+ PG_CMD_DECL;
+ char **line;
+ static char *postgres_setup[] = {
+ "CREATE DATABASE postgres;\n",
+ NULL
+ };
+
+ fputs(_("copying template1 to postgres ... "), stdout);
+ fflush(stdout);
+
+ snprintf(cmd, sizeof(cmd),
+ "\"%s\" %s template1 >%s",
+ backend_exec, backend_options,
+ DEVNULL);
+
+ PG_CMD_OPEN;
+
+ for (line = postgres_setup; *line; line++)
+ PG_CMD_PUTS(*line);
+
+ PG_CMD_CLOSE;
+
+ check_ok();
+}
+
/*
* signal handler in case we are interrupted.
make_template0();
+ make_postgres();
+
if (authwarning != NULL)
fprintf(stderr, "%s", authwarning);
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.57 2005/05/04 22:35:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.58 2005/06/21 04:02:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
for (i = 0; i < wait_seconds; i++)
{
if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL,
- "template1", NULL, NULL)) != NULL &&
+ "postgres", NULL, NULL)) != NULL &&
(PQstatus(conn) == CONNECTION_OK ||
(strcmp(PQerrorMessage(conn),
PQnoPasswordSupplied) == 0)))
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.59 2005/04/18 23:47:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.60 2005/06/21 04:02:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
- conn = connectDatabase("template1", pghost, pgport, pguser, force_password);
+ conn = connectDatabase("postgres", pghost, pgport, pguser, force_password);
printf("--\n-- PostgreSQL database cluster dump\n--\n\n");
if (verbose)
dumpTimestamp("Started on");
- printf("\\connect \"template1\"\n\n");
+ printf("\\connect \"postgres\"\n\n");
if (!data_only)
{
/*
* Win32 has to use double-quotes for args, rather than single quotes.
* Strangely enough, this is the only place we pass a database name on
- * the command line, except template1 that doesn't need quoting.
+ * the command line, except "postgres" which doesn't need quoting.
*/
#ifndef WIN32
appendPQExpBuffer(cmd, "%s\"%s\" %s -Fp '", SYSTEMQUOTE, pg_dump_bin,
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.117 2005/06/14 02:57:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.118 2005/06/21 04:02:33 tgl Exp $
*/
#include "postgres_fe.h"
{
need_pass = false;
pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL,
- options.action == ACT_LIST_DB ? "template1" : options.dbname,
+ options.action == ACT_LIST_DB ? "postgres" : options.dbname,
username, password);
if (PQstatus(pset.db) == CONNECTION_BAD &&
*
* Portions Copyright (c) 2002-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.12 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.13 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
PGresult *result;
int i;
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn;", progname, echo);
PQfinish(conn);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.14 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.15 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
appendPQExpBuffer(&sql, " TEMPLATE %s", fmtId(template));
appendPQExpBuffer(&sql, ";\n");
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres",
+ host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.16 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.17 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
appendPQExpBuffer(&sql, " NOCREATEUSER");
appendPQExpBuffer(&sql, ";\n");
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.14 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.15 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
appendPQExpBuffer(&sql, "DROP DATABASE %s;\n",
fmtId(dbname));
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres",
+ host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.13 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.14 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
initPQExpBuffer(&sql);
appendPQExpBuffer(&sql, "DROP USER %s;\n", fmtId(dropuser));
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.12 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.13 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
PGresult *result;
int i;
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn;", progname, echo);
PQfinish(conn);
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.279 2005/06/20 10:29:37 teodor Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.280 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200506201
+#define CATALOG_VERSION_NO 200506202
#endif
if (getenv("SQLOPT")) ECPGdebug(1,stderr);
exec sql whenever sqlerror do sqlprint();
- exec sql connect to template1;
+ exec sql connect to postgres;
exec sql allocate descriptor mydesc;
exec sql select tablename into descriptor mydesc from pg_tables;
# A service is a set of named connection parameters. You may specify
# multiple services in this file. Each starts with a service name in
# brackets. Subsequent lines have connection configuration parameters of
-# the pattern "param=value". A sample configuration for template1 is
+# the pattern "param=value". A sample configuration for postgres is
# included in this file. Lines beginning with '#' are comments.
#
# Copy this to your sysconf directory (typically /usr/local/pgsql/etc) and
# rename it pg_service.conf.
#
#
-#[template1]
-#dbname=template1
+#[postgres]
+#dbname=postgres
#user=postgres
#!/bin/sh
-# $PostgreSQL: pgsql/src/test/bench/create.sh,v 1.4 2004/09/01 17:25:40 tgl Exp $
+# $PostgreSQL: pgsql/src/test/bench/create.sh,v 1.5 2005/06/21 04:02:34 tgl Exp $
#
if [ ! -d $1 ]; then
echo " you must specify a valid data directory " >&2
fi
echo =============== destroying old bench database... =================
-echo "drop database bench" | postgres -D${1} template1 > /dev/null
+echo "drop database bench" | postgres -D${1} postgres > /dev/null
echo =============== creating new bench database... =================
-echo "create database bench" | postgres -D${1} template1 > /dev/null
+echo "create database bench" | postgres -D${1} postgres > /dev/null
if [ $? -ne 0 ]; then
echo createdb failed
exit 1
/*
* If the user supplies a parameter on the command line, use it as the
- * conninfo string; otherwise default to setting dbname=template1 and
+ * conninfo string; otherwise default to setting dbname=postgres and
* using environment variables or defaults for all other connection
* parameters.
*/
if (argc > 1)
conninfo = argv[1];
else
- conninfo = "dbname = template1";
+ conninfo = "dbname = postgres";
/* Make a connection to the database */
conn = PQconnectdb(conninfo);
/*
* If the user supplies a parameter on the command line, use it as the
- * conninfo string; otherwise default to setting dbname=template1 and
+ * conninfo string; otherwise default to setting dbname=postgres and
* using environment variables or defaults for all other connection
* parameters.
*/
if (argc > 1)
conninfo = argv[1];
else
- conninfo = "dbname = template1";
+ conninfo = "dbname = postgres";
/* Make a connection to the database */
conn = PQconnectdb(conninfo);
/*
* If the user supplies a parameter on the command line, use it as the
- * conninfo string; otherwise default to setting dbname=template1 and
+ * conninfo string; otherwise default to setting dbname=postgres and
* using environment variables or defaults for all other connection
* parameters.
*/
if (argc > 1)
conninfo = argv[1];
else
- conninfo = "dbname = template1";
+ conninfo = "dbname = postgres";
/* Make a connection to the database */
conn = PQconnectdb(conninfo);
#! /bin/sh
-# $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.56 2005/06/20 02:26:50 tgl Exp $
+# $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.57 2005/06/21 04:02:34 tgl Exp $
me=`basename $0`
: ${TMPDIR=/tmp}
# wait forever, however.
i=0
max=60
- until "$bindir/psql" -X $psql_options template1 </dev/null 2>/dev/null
+ until "$bindir/psql" -X $psql_options postgres </dev/null 2>/dev/null
do
i=`expr $i + 1`
if [ $i -ge $max ]