Re: [HACKERS] Removing binaries

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [HACKERS] Removing binaries
Дата
Msg-id CA+TgmoZ7CGM_V3bvsatm-J8OHEzSqFdNMzeSmjU8A6vzPBanaQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Removing binaries  (David Steele <david@pgmasters.net>)
Ответы Re: [HACKERS] Removing binaries  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Removing binaries  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
On Mon, Mar 20, 2017 at 6:15 PM, David Steele <david@pgmasters.net> wrote:
> On 3/20/17 3:40 PM, Jan de Visser wrote:
>> On Monday, March 20, 2017 3:30:49 PM EDT Robert Haas wrote:
>>> That would annoy me, because I use these constantly.  I also think
>>> that they solve a problem for users, which is this:
>>>
>>> [rhaas ~]$ psql
>>> psql: FATAL:  database "rhaas" does not exist
>>> [rhaas ~]$ psql -c 'create database rhaas;'
>>> psql: FATAL:  database "rhaas" does not exist
>>> [rhaas ~]$ gosh, i know i need to connect to a database in order to
>>> create the database to which psql tries to connect by default, so
>>> there must be an existing database with some name, but what exactly is
>>> that name, anyway?
>>> -bash: gosh,: command not found
>>>
>>> There was an occasion when this exact problem almost caused me to give
>>> up on using PostgreSQL.  Everybody here presumably knows that
>>> template1 and postgres are the magic words you can add to the end of
>>> that command line to make it work, but that is NOT self-evident to
>>> newcomers.
>>
>> Same here. I worked on a system with a shrink-wrap installer which
>> installed
>> pgsql as well and initialized it for use by the system user of our
>> software.
>> If a tester or sales engineer wanted to play with the DB, it would be
>> about 30
>> minutes before they would end up at my desk, in tears.
>
> How about adding a hint?

I think it's tricky to do that, because the error happens in response
to the connection attempt and at that point you don't know that the
command the user plans to send is CREATE DATABASE.  If we could
somehow detect that the user is trying to CREATE DATABASE against a
nonexistent database and hint in that case, that would be *great*, but
I don't see a way to make it work.

Here's another idea: what if we always created the default database at
initdb time?  For example, if I initdb as rhaas, maybe it should
create an "rhaas" database for me, so that this works:

initdb
pg_ctl start
psql

I think a big part of the usability problem here comes from the fact
that the default database for connections is based on the username,
but the default databases that get created have fixed names (postgres,
template1).  So the default configuration is one where you can't
connect.  Why the heck do we do it that way?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: [HACKERS] WIP: [[Parallel] Shared] Hash
Следующее
От: Michael Banck
Дата:
Сообщение: Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present