]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 542507 - [PostgreSQL] The db_user sometimes cannot connect to the "template1...
authorDylan William Hardison <dylan@hardison.net>
Fri, 8 Jul 2016 16:59:29 +0000 (12:59 -0400)
committerGitHub <noreply@github.com>
Fri, 8 Jul 2016 16:59:29 +0000 (12:59 -0400)
Bugzilla/DB.pm
Bugzilla/DB/Pg.pm
docs/en/rst/installing/postgresql.rst
template/en/default/setup/strings.txt.pl

index 6832e0ce715a063ddd96756affa7adc674fbf9c3..68582305fcf897f8e961b92c5f8a5d7bfeeb751f 100644 (file)
@@ -247,7 +247,6 @@ sub _get_no_db_connection {
     my ($sql_server) = @_;
     my $dbh;
     my %connect_params = %{ Bugzilla->localconfig };
-    $connect_params{db_name} = '';
     my $conn_success = eval {
         $dbh = _connect(\%connect_params);
     };
index 9ef7f77f1c60f8f112916ba01b8d8213f6ed3a83..ed1a4aa7d957f0cecf80373d22828673c6abfeee 100644 (file)
@@ -36,14 +36,9 @@ use constant BLOB_TYPE => { pg_type => DBD::Pg::PG_BYTEA };
 
 sub new {
     my ($class, $params) = @_;
-    my ($user, $pass, $host, $dbname, $port) = 
+    my ($user, $pass, $host, $dbname, $port) =
         @$params{qw(db_user db_pass db_host db_name db_port)};
 
-    # The default database name for PostgreSQL. We have
-    # to connect to SOME database, even if we have
-    # no $dbname parameter.
-    $dbname ||= 'template1';
-
     # construct the DSN from the parameters we got
     my $dsn = "dbi:Pg:dbname=$dbname";
     $dsn .= ";host=$host" if $host;
index 8e8c4a08bb31ea0df1a2bdb531cb31bb4d0c1500..10455488c45f22c158ea17f95964d1b174d126af 100644 (file)
@@ -14,8 +14,8 @@ server is started when the machine boots.
 
 .. _posgresql-add-user:
 
-Add a User
-==========
+Add a User and Create a DB
+==========================
 
 You need to add a new user to PostgreSQL for the Bugzilla
 application to use when accessing the database. The following instructions
@@ -29,12 +29,18 @@ then switch to being the postgres (Unix) user:
 
 As the postgres user, you then need to create a new user:
 
-:command:`createuser -U postgres -dRSP bugs`
+:command:`createuser -U postgres -DRSP bugs`
 
 When asked for a password, provide one and write it down for later reference.
 
 The created user will not be a superuser (-S) and will not be able to create
-new users (-R). He will only have the ability to create databases (-d).
+new users (-R) or create databases (-D).
+
+Next we will create a database for bugzilla to use
+
+:command:`createdb -U postgress -O bugs bugs`
+
+This will create a database named `bugs` that is owned (-O) by the `bugs` user.
 
 .. _postgresql-access:
 
index 4b1bc873e91cf866d7bed199e879aa36f722d39a..3adb06b8571f878ce777f705ca25478b82c1f787 100644 (file)
@@ -141,6 +141,7 @@ END
     localconfig_db_name => <<'END',
 The name of the database. For Oracle, this is the database's SID. For
 SQLite, this is a name (or path) for the DB file.
+For postgres, this database must already exist and be writable by $db_user.
 END
     localconfig_db_pass => <<'END',
 Enter your database password here. It's normally advisable to specify