> > 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