I'd like to post a question for all of you postgresql gurus. In a new
installation of postgresql, is it SOP to add a database called postgres?
My situation is this. I require connecting to a remote postgresql
server and create/access databases remotely. When I use the createdb
command on the local machine like so: createdb -U sa -h 192.168.1.1
testdb, this will return an error that the database postgres is not
found. The sa user is granted ability to breate databases.
The maddening thing about this, is when you execute the same command on
the local machine with a Postgresql server running, just createdb -U sa
testdb, the database gets created with nary a squeak.
The question is why is database postgres is required to be present on
the remote Postgresql server, before a regular user, with create
database permission, can create a database?
The postgres DB was added in 8.1. Createdb, createuser, and the like
were modified to use postgres instead of the old template1 because of
locking issues when template1 is in use while trying to create a DB.
To quote the changelog:
* Make initdb create a new standard database called postgres, and
convert utilities to use postgres rather than template1 for
standard lookups (Dave)
In prior releases, template1 was used both as a default connection
for utilities like createuser, and as a template for new databases.
This caused "CREATE DATABASE" to sometimes fail, because a new
database cannot be created if anyone else is in the template
database. With this change, the default connection database is now
postgres, meaning it is much less likely someone will be using
template1 during "CREATE DATABASE".
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph