Magnus Hagander wrote:
Umm. Tiny item, but your comment still refers to the database as
pg_system ;-)


:-)

Regards,
Andreas
Index: src/bin/initdb/initdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.83
diff -u -r1.83 initdb.c
--- src/bin/initdb/initdb.c     30 Apr 2005 08:08:51 -0000      1.83
+++ src/bin/initdb/initdb.c     18 Jun 2005 08:54:07 -0000
@@ -177,6 +177,7 @@
 static void set_info_version(void);
 static void setup_schema(void);
 static void vacuum_db(void);
+static void make_default(void);
 static void make_template0(void);
 static void trapsig(int signum);
 static void check_ok(void);
@@ -1828,6 +1829,38 @@
 }
 
 /*
+ * copy template1 to default
+ */
+static void
+make_default(void)
+{
+       PG_CMD_DECL;
+       char      **line;
+       static char *default_setup[] = {
+               "CREATE DATABASE \"default\";\n",
+               "REVOKE CREATE,TEMPORARY ON DATABASE \"default\" FROM 
public;\n",
+               NULL
+       };
+
+       fputs(_("copying template1 to default ... "), stdout);
+       fflush(stdout);
+
+       snprintf(cmd, sizeof(cmd),
+                        "\"%s\" %s template1 >%s",
+                        backend_exec, backend_options,
+                        DEVNULL);
+
+       PG_CMD_OPEN;
+
+       for (line = default_setup; *line; line++)
+               PG_CMD_PUTS(*line);
+
+       PG_CMD_CLOSE;
+
+       check_ok();
+}
+
+/*
  * copy template1 to template0
  */
 static void
@@ -2606,6 +2639,8 @@
 
        vacuum_db();
 
+       make_default();
+
        make_template0();
 
        if (authwarning != NULL)
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to