Thread: Determine PG version used for initdb

Determine PG version used for initdb

From
Hannes Dorbath
Date:
Is it possible to determine if PG 8.0.1's initdb or PG 8.0.3's initdb
was used to init a cluster? I fear I am accidental running a 8.0.1
postmaster on a 8.0.3 cluster due to wrong env vars :(

Do I have to fear corruption btw?

Thanks

Re: Determine PG version used for initdb

From
"Joshua D. Drake"
Date:
Hannes Dorbath wrote:
> Is it possible to determine if PG 8.0.1's initdb or PG 8.0.3's initdb
> was used to init a cluster? I fear I am accidental running a 8.0.1
> postmaster on a 8.0.3 cluster due to wrong env vars :(
>

show server_version;

from psql.

> Do I have to fear corruption btw?
>
> Thanks
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faq


--
Your PostgreSQL solutions provider, Command Prompt, Inc.
24x7 support - 1.800.492.2240, programming, and consulting
Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit
http://www.commandprompt.com / http://www.postgresql.org

Re: Determine PG version used for initdb

From
Hannes Dorbath
Date:
On 20.07.2005 15:40, Joshua D. Drake wrote:
> show server_version;
>
> from psql.

That tells the server version running, but does it tell the initdb
binary version used to init the cluster?

Re: Determine PG version used for initdb

From
"Dario"
Date:
There shouldn't be problems. "Updating" from 8.0.1 to 8.0.3 is just matter
of changing binaries.
"Upgrading" from 8.0 to 8.1 or 7.3 to 7.4 requires dump, cleaning
directories and restore.

Take a look at forum archives anyway, to confirm this and read about
experiences.

Greetings (saludos /sah loo dohs/)

-----Mensaje original-----
De: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]En nombre de Hannes Dorbath
Enviado el: miércoles, 20 de julio de 2005 10:53
Para: pgsql-admin@postgresql.org
Asunto: Re: [ADMIN] Determine PG version used for initdb


On 20.07.2005 15:40, Joshua D. Drake wrote:
> show server_version;
>
> from psql.

That tells the server version running, but does it tell the initdb
binary version used to init the cluster?

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


Re: Determine PG version used for initdb

From
Tom Lane
Date:
> That tells the server version running, but does it tell the initdb
> binary version used to init the cluster?

Normally there's not any difference between dot-release initdb's.
In this case there is; read the 8.0.3 release notes:
http://developer.postgresql.org/docs/postgres/release.html#RELEASE-8-0-3
You could determine which was used by looking at the declared arguments
of the conversion functions.

            regards, tom lane

Re: Determine PG version used for initdb

From
Hannes Dorbath
Date:
On 20.07.2005 15:55, Dario wrote:
> There shouldn't be problems. "Updating" from 8.0.1 to 8.0.3 is just matter
> of changing binaries.

I recall that as well, but I remember security problems in < 8.0.3 that
are fixed by the 8.0.3 initdb, that's why I wanted to know exactly what
I have..

Thanks so far

Re: Determine PG version used for initdb

From
Hannes Dorbath
Date:
On 20.07.2005 16:05, Tom Lane wrote:
> You could determine which was used by looking at the declared arguments
> of the conversion functions.

Seems to be 8.0.1, so I'll follow the manual repair instructions in the
7.4.8 release notes.

Thanks for the fast help.

Re: Determine PG version used for initdb

From
"Joel Fradkin"
Date:
Not being a postgres guru can you give me a simple plan to follow to re init
db.
I am running on linux redhat as4.
I have links to spindles for my wal and my data.
I am on 8.0.3, but did not initdb the database, so security issues have not
been addressed.
I can do a dump, initdb (this is where I am not 100% sure what to do, to get
rid of the existing intdb stuff) and do a restore.

I am guessing I would just stop postgres delete the data folder in
/var/lib/pgsql.

Go into the pgsql folder and do a initdb database name? prefer to do it
Unicode if I can get my drivers and such figured and tested (still having
serious issues there).

Re-link the wal and base folders

And I am done?

What would be the exact syntax for the initdb command?


Joel Fradkin

Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel.  941-753-7111 ext 305

jfradkin@wazagua.com
www.wazagua.com
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
 This email message is for the use of the intended recipient(s) and may
contain confidential and privileged information.  Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and delete and destroy
all copies of the original message, including attachments.




-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Tom Lane
Sent: Wednesday, July 20, 2005 10:05 AM
To: Dario
Cc: Hannes Dorbath; pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Determine PG version used for initdb

> That tells the server version running, but does it tell the initdb
> binary version used to init the cluster?

Normally there's not any difference between dot-release initdb's.
In this case there is; read the 8.0.3 release notes:
http://developer.postgresql.org/docs/postgres/release.html#RELEASE-8-0-3
You could determine which was used by looking at the declared arguments
of the conversion functions.

            regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Re: Determine PG version used for initdb

From
Michael Fuhr
Date:
On Wed, Jul 20, 2005 at 03:21:42PM +0200, Hannes Dorbath wrote:
> Is it possible to determine if PG 8.0.1's initdb or PG 8.0.3's initdb
> was used to init a cluster? I fear I am accidental running a 8.0.1
> postmaster on a 8.0.3 cluster due to wrong env vars :(

That shouldn't matter -- the postmaster will refuse to start if it
doesn't like the catalog version; otherwise you should be okay.

In general you don't have to initdb when upgrading to a new point
release, and the Release Notes should tell you if it's necessary
or not.  Sometimes an initdb might be desirable, however, to fix
certain catalog problems -- this is the case with 8.0.3, for example.
If you don't want to initdb then there's a manual fix procedure:

http://www.postgresql.org/docs/8.0/static/release.html#RELEASE-8-0-3

I think the following query shows the version of initdb that
initialized the cluster, but somebody please correct me if I'm
mistaken:

SELECT character_value
FROM information_schema.sql_implementation_info
WHERE implementation_info_name = 'DBMS VERSION';

The value displayed appears to have been created by set_info_version()
in initdb.c.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: Determine PG version used for initdb

From
Hannes Dorbath
Date:
On 20.07.2005 16:33, Joel Fradkin wrote:
> What would be the exact syntax for the initdb command?

initdb -D /var/lib/pgsql/data --locale=de_DE.utf8

replace de_DE.utf8 with your locale..

Re: Determine PG version used for initdb

From
"Jim C. Nasby"
Date:
On Wed, Jul 20, 2005 at 10:05:22AM -0400, Tom Lane wrote:
> > That tells the server version running, but does it tell the initdb
> > binary version used to init the cluster?
>
> Normally there's not any difference between dot-release initdb's.
> In this case there is; read the 8.0.3 release notes:
> http://developer.postgresql.org/docs/postgres/release.html#RELEASE-8-0-3
> You could determine which was used by looking at the declared arguments
> of the conversion functions.

Hrm. Is there no definative way to determine what version of initdb was
used on a cluster? ISTM that would be a useful feature to have.
--
Jim C. Nasby, Database Consultant               decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

Re: Determine PG version used for initdb

From
Michael Fuhr
Date:
On Wed, Jul 20, 2005 at 10:59:34AM -0500, Jim C. Nasby wrote:
>
> Hrm. Is there no definative way to determine what version of initdb was
> used on a cluster? ISTM that would be a useful feature to have.

The query I posted in another message appears to work in 7.4 and
later (i.e., versions that have the Information Schema):

SELECT character_value
FROM information_schema.sql_implementation_info
WHERE implementation_info_name = 'DBMS VERSION';

Unless I'm misreading what set_info_version() and setup_schema()
do in initdb.c, the above query will return a value based on the
value of PG_VERSION that was current when the initdb that initialized
the cluster was built.  Although that raises a question: is that
the desired behavior, or should 'DBMS VERSION' return the version
currently running?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/