Skip site navigation (1) Skip section navigation (2)

Re: Name switch

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Adam Van Ornum" <greatbob6(at)hotmail(dot)com>,pgsql-novice(at)postgresql(dot)org
Subject: Re: Name switch
Date: 2002-10-21 15:52:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

> I had a really weird problem crop up a couple of days ago.  I just
> recently installed PostgreSQL on FreeBSD 4.6.2 and have been playing
> around with it.  Most of my experience is with SQL Server 7 on the
> Windows platform (of course) so there's lots of little things to play
> with.  Anyway, I created a database called "media" and then created a
> couple of tables and added some information to several of the tables.
>  From my Windows box I tried to access the database through ODBC and
> it said that my table did not exist in the DB. 
>  I think got on my FreeBSD box and checked it out and found that
> apparently 
> there were no tables in my "media" db.  Eventually I found out that
> it appears that my "media" db somehow switched with "template1".  Has
> anyone else had this happen?  Did I do something majorly stupid?

No, you just forgot to switch to the "media" database after creating
it.  In a new DB system, "template1" is the only accessable database.

If you don't have anything worth saving, then the simplest way to clean
up "template1" is to delete the contents of the pgsql/data directory,
and re-run "initdb".   Then you can start over with a clean slate.

If you've spent a lot of time tinkering with "media", then:
2) CREATE DATABASE media; --this will create the database with the same
tables and views you accidentally put in template1
3) Follow the rest of my instructions in my article on Techdocs on
cleaning the template1 database.

Also, there are several articles on moving from SQL Server to
PostgreSQL at techdocs:

-Josh Berkus

In response to

  • Name switch at 2002-10-17 02:59:28 from Adam Van Ornum

pgsql-novice by date

Next:From: Josh BerkusDate: 2002-10-21 15:54:45
Subject: Re: how to create secondary key!!
Previous:From: Josh BerkusDate: 2002-10-21 15:44:30
Subject: Re: db design question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group