~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/bin/scripts/createdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-06-14 09:53:29 UTC
  • mto: (6.1.1 sid) (10.1.1 oneiric-proposed) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20110614095329-71gfhjywyp2c27au
Tags: upstream-9.1~beta2
ImportĀ upstreamĀ versionĀ 9.1~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
 
193
193
        appendPQExpBuffer(&sql, ";\n");
194
194
 
 
195
        /*
 
196
         * Connect to the 'postgres' database by default, except have the
 
197
         * 'postgres' user use 'template1' so he can create the 'postgres'
 
198
         * database.
 
199
         */
195
200
        conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres",
196
201
                                                   host, port, username, prompt_password, progname);
197
202
 
208
213
        }
209
214
 
210
215
        PQclear(result);
211
 
        PQfinish(conn);
212
216
 
213
217
        if (comment)
214
218
        {
215
 
                conn = connectDatabase(dbname, host, port, username, prompt_password, progname);
216
 
 
217
219
                printfPQExpBuffer(&sql, "COMMENT ON DATABASE %s IS ", fmtId(dbname));
218
220
                appendStringLiteralConn(&sql, comment, conn);
219
221
                appendPQExpBuffer(&sql, ";\n");
231
233
                }
232
234
 
233
235
                PQclear(result);
234
 
                PQfinish(conn);
235
236
        }
236
237
 
 
238
        PQfinish(conn);
 
239
 
237
240
        exit(0);
238
241
}
239
242