Commit 5880669d authored by Dylan William Hardison's avatar Dylan William Hardison Committed by GitHub

Bug 542507 - [PostgreSQL] The db_user sometimes cannot connect to the "template1" database

parent c0cf9b11
......@@ -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);
};
......
......@@ -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;
......
......@@ -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:
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment