Re: In which case PG_VERSION file updates ? - Mailing list pgsql-general

From Raghavendra
Subject Re: In which case PG_VERSION file updates ?
Date
Msg-id CA+h6Ahhpnh5GaCKaWC2_DEdDPooZ+Vqy=HyQenrcE+yFH1UuZA@mail.gmail.com
Whole thread Raw
In response to Re: In which case PG_VERSION file updates ?  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
From what I can see, PG_VERSION is written at database creation to document the
major version of the Postgres instance used to create the database.  Since it
only holds the major version string (i.e. 9.0) it is not touched during minor
updates, for example 9.0.0 --> 9.0.1.  Grepping the pg_upgrade code shows it
might touch PG_VERSION.  A quick grep on the rest of the source code shows only
initdb writing out PG_VERSION, though it is checked by other code. This is by no
means an in depth look and it would take some one with more knowledge of
Postgres internals to give you a definitive answer. Might be worth a post on -
hackers.

Thank you Adrian Klaver / Scott Marlowe for your valuable inputs. I got clarified.

As said, PG_VERSION file is created at the time of Database creation.
Sometimes, question arises that at what time database created. For this we don't have any information to get from pg_catalogs, so  with PG_VERSION file timestamp we can pull database creation time. 

However, with your inputs its clear that when PG_VERSION file is touched. In pg_upgrade or any of the Postgres Internals touching PG_VERSION file will never get exact database creation time.
 
I am not knowing why database creation time is not considered to be in pg_catalogs.

-- Raghav

pgsql-general by date:

Previous
From: DUPREZ Cédric
Date:
Subject: Problem with pg_upgrade from 9.0 to 9.1 under Ubuntu x64
Next
From: Merlin Moncure
Date:
Subject: Re: Sending Results From One Function As Input into Another Function