Thread: Problem with 'postgres' db with 8.0 on a MacBook

Problem with 'postgres' db with 8.0 on a MacBook

From
Jonathon McKitrick
Date:
Hi all,

this is my first time posting here because I've been running pgsql without
problem on a couple of Linux boxes for a while now.

I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
and start a postmaster, any time I try createdb or createuser, I get a message
that the database 'postgres' cannot be found.

I installed after a manual build, chown'ed /usr/local/pgsql to postgres, added
a 'data' directory, and called initdb on it.  But all calls to createdb or
createuser gave the message above.

Can anyone help?

Jonathon McKitrick
--
My other computer is your Windows box.

Re: Problem with 'postgres' db with 8.0 on a MacBook

From
Markus Schiltknecht
Date:
Hi Jonathon,

does the following command succeed?

# psql template1 -c "CREATE DATABASE test;"

The database 'postgres' is a system table which has been added in 8.2
(or 8.1 already, dunno). It should exist if you used the correct initdb
and postmaster.

What does psql -l say?

And did you recheck permissions in pg_hba.conf?

BTW: nice laptop, isn't it? Linux still needs some work to run it,
tough. But I'm getting there ;-)

Regards

Markus

Jonathon McKitrick wrote:
> Hi all,
>
> this is my first time posting here because I've been running pgsql without
> problem on a couple of Linux boxes for a while now.
>
> I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
> and start a postmaster, any time I try createdb or createuser, I get a message
> that the database 'postgres' cannot be found.
>
> I installed after a manual build, chown'ed /usr/local/pgsql to postgres, added
> a 'data' directory, and called initdb on it.  But all calls to createdb or
> createuser gave the message above.
>
> Can anyone help?
>
> Jonathon McKitrick
> --
> My other computer is your Windows box.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

Re: Problem with 'postgres' db with 8.0 on a MacBook

From
Tom Lane
Date:
Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> writes:
> I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
> and start a postmaster, any time I try createdb or createuser, I get a message
> that the database 'postgres' cannot be found.

It sounds to me like you're trying to use PG 8.1 client tools with an
8.0 (or older) postmaster.  8.1 tools expect there to be a 'postgres'
database created by default, but that is not the convention in older
releases.  Better check exactly what's laying around already on that
machine.  Apple does ship some version of Postgres in OS X IIRC...

            regards, tom lane

Re: Problem with 'postgres' db with 8.0 on a MacBook

From
Markus Schiltknecht
Date:
Hi Jonathon,

Jonathon McKitrick wrote:
> : # psql template1 -c "CREATE DATABASE test;"
>
> CREATE DATABASE
>
> is the result.

Looks good. Can you connect to that database then?

> : What does psql -l say?
>
> FATAL: database 'postgres' does not exist

As Tom said: check if you are really calling you self-compiled binaries:

# which pgsql

Markus

Re: Problem with 'postgres' db with 8.0 on a MacBook

From
Shane Ambler
Date:
One thing I have noticed with my install (may be something carrying over
from an old version or howto I followed way back) is that the main user is
pgsql but the default db is postgres I find I need to use
#psql -U pgsql -d postgres

By default psql tries to connect to the database of the same name as the
pgsql user you log in as (unless specified with the -U option it will use
the current system username)

You may want to use '-d test' to match the test db you created with the
previous instruction or another that shows in the psql -l list.

On 8/6/2006 3:18, "Markus Schiltknecht" <markus@bluegap.ch> wrote:

> Hi Jonathon,
>
> Jonathon McKitrick wrote:
>> : # psql template1 -c "CREATE DATABASE test;"
>>
>> CREATE DATABASE
>>
>> is the result.
>
> Looks good. Can you connect to that database then?
>
>> : What does psql -l say?
>>
>> FATAL: database 'postgres' does not exist
>
> As Tom said: check if you are really calling you self-compiled binaries:
>
> # which pgsql
>
> Markus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>


Re: Problem with 'postgres' db with 8.0 on a MacBook

From
Jonathon McKitrick
Date:
On Wed, Jun 07, 2006 at 10:31:22AM -0400, Tom Lane wrote:
: Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> writes:
: > I'm migrating to a new MacBook, and while I finally got it to compile, initdb,
: > and start a postmaster, any time I try createdb or createuser, I get a message
: > that the database 'postgres' cannot be found.
:
: It sounds to me like you're trying to use PG 8.1 client tools with an
: 8.0 (or older) postmaster.  8.1 tools expect there to be a 'postgres'
: database created by default, but that is not the convention in older
: releases.  Better check exactly what's laying around already on that
: machine.  Apple does ship some version of Postgres in OS X IIRC...

That could very well be.  I've been installing a couple of versions over one
another, since I couldn't get them to work for various reasons and because gnu
software doesn't have a 'make deinstall'.

How can I remove all the cruft from a previous version?

And where is pg_hba.conf?



Jonathon McKitrick
--
My other computer is your Windows box.

Re: Problem with 'postgres' db with 8.0 on a MacBook

From
Jonathon McKitrick
Date:
Thanks for the help, guys.  I've learned from this the importance of keeping a
journal of software installation.

Jonathon McKitrick
--
My other computer is your Windows box.