Re: Removing binaries

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Jan de Visser <jan(at)de-visser(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: Removing binaries
Date: 2017-03-21 12:12:23
Message-ID: CA+TgmoZ7CGM_V3bvsatm-J8OHEzSqFdNMzeSmjU8A6vzPBanaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 20, 2017 at 6:15 PM, David Steele <david(at)pgmasters(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2017-03-21 12:17:24 Re: Create replication slot in pg_basebackup if requested and not yet present
Previous Message Thomas Munro 2017-03-21 12:07:00 Re: WIP: [[Parallel] Shared] Hash