Thread: Numerical DB/Table Names

Numerical DB/Table Names

From
Jeff Brickley
Date:
I've just recently started working with PostgreSQL.  We have a 7.0
insallation and everything seems to work fine.  I am embarking on
upgrading to 7.1.3 but have run into a problem.  All of the databases
are stored with numerical names in the /$prefix/base directory.  They
seem to be stored as binaries so I am unable to open any files under
that directory.  I know that in our 7.0 version of PostgreSQL all
databases have a directory under the /$prefix/base directory that is
labeled as the name of the database.  Inside each database directory the
physical data is stored in files that have the same name as all the
relationships in the database.  I can still insert and retrieve data
from any database created on this new 7.1.3 cluster but am not
comfortable with not being able to read the data files.
Has anyone encountered this problem?  Thanks in advance for any help you
can provide.

Jeff


Re: Numerical DB/Table Names

From
Stephan Szabo
Date:
On Fri, 14 Sep 2001, Jeff Brickley wrote:

> I've just recently started working with PostgreSQL.  We have a 7.0
> insallation and everything seems to work fine.  I am embarking on
> upgrading to 7.1.3 but have run into a problem.  All of the databases
> are stored with numerical names in the /$prefix/base directory.  They
> seem to be stored as binaries so I am unable to open any files under
> that directory.  I know that in our 7.0 version of PostgreSQL all
> databases have a directory under the /$prefix/base directory that is
> labeled as the name of the database.  Inside each database directory the
> physical data is stored in files that have the same name as all the
> relationships in the database.  I can still insert and retrieve data
> from any database created on this new 7.1.3 cluster but am not
> comfortable with not being able to read the data files.
> Has anyone encountered this problem?  Thanks in advance for any help you
> can provide.

From contrib/oid2name's readme:
"With version 7.1 of PostgreSQL server,  the old naming scheme for
databases and tables (in $PGDATA/base) has changed.  The databases
are put in folders for their OID in pg_database and the tables in
that folder are named for their OIDs in pg_class."

The reason for the change was IIRC to better handle rollback of
create/drop statements.  It looks like the contrib/oid2name will
give you the #/name relationships (although it probably connects
to the database to do it)


Re: Numerical DB/Table Names

From
Peter Eisentraut
Date:
Jeff Brickley writes:

> I've just recently started working with PostgreSQL.  We have a 7.0
> insallation and everything seems to work fine.  I am embarking on
> upgrading to 7.1.3 but have run into a problem.  All of the databases
> are stored with numerical names in the /$prefix/base directory.  They
> seem to be stored as binaries so I am unable to open any files under
> that directory.

You are not supposed to be opening any internal files in any release.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: Numerical DB/Table Names

From
"Joe Conway"
Date:
> upgrading to 7.1.3 but have run into a problem.  All of the databases
> are stored with numerical names in the /$prefix/base directory.  They
> seem to be stored as binaries so I am unable to open any files under
> that directory.  I know that in our 7.0 version of PostgreSQL all
> databases have a directory under the /$prefix/base directory that is
> labeled as the name of the database.  Inside each database directory the
> physical data is stored in files that have the same name as all the
> relationships in the database.  I can still insert and retrieve data
> from any database created on this new 7.1.3 cluster but am not
> comfortable with not being able to read the data files.
> Has anyone encountered this problem?  Thanks in advance for any help you
> can provide.

In 7.1+ the directories and files are named by their OIDs. See the README in
contrib/oid2name for more information. I haven't used it myself, but the
oid2name contib should let you more easily associate the OID names with the
database object names.

Hope this helps,

-- Joe