Re: pgAdmin II questions

From: Andrew Biagioni <andrew(dot)biagioni(at)e-greek(dot)net>
To: Tamir Halperin <tamir(at)brobus(dot)net>, Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: pgAdmin II questions
Date: 2003-03-31 14:56:31
Message-ID: NLSMZY3WRLMKHFRQSQ31427494QM1W6Z.3e88571f@Laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I have considerable experience with PGAdmin. I haven't seen a db called
"pgsql", but then I use Linux.

Template DBs are used when creating other databases (see details on CREATE
DATABASE command in doc.); they are DBs marked as "templates" to prevent users
from altering them, and that of course includes preventing deletion.
"template0" is the pre-installed template which comes with a new data space,
and cannot be edited/removed. "template1" is the default, editable template,
which you are supposed to customize to match the requirements you will have for
all new DBs you create (for example, you can specify the encoding, add some
default tables/functions/etc. that will be created in every new DB you create,
unless you specify a different source template).

PGAdmin has a "logic" flaw when trying to drop DBs: it accesses them when you
click them to drop them, and in so doing they are marked by PostgreSQL as being
"in use". Result: to delete them, you mark them as "in use"; marking them
"in use" prevents their deletion. This is similar to the case where you use
psql, and try to delete the DB you are connected to; you have to change DB
("\c template1" will do it) otherwise you are trying to pull the rug from under
your own feet.

I haven't found a work-around yet, but then I haven't really tried; I use psql
from the command line to do it anyway. You may want to check whether there is
a bug filed in pgadmin.postgresql.org on the matter (they may be about to fix
it)

Andrew

3/30/03 3:21:43 PM, Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> wrote:

>
>I don't know much about pgAdmin itself, but...
>
>On Sun, 30 Mar 2003, Tamir Halperin wrote:
>
>> I remember creating a db called taxcal and it's listed there. However,
>> I don't remember creating a db called pgsql.
>
>It's possible it got created as a side effect of the system upgrade.
>
>> Also, I can't drop it (by right clicking on it and selecting drop
>> object from the shortcut menu. After being warned that the action
>> cannot be undone I agree and an error comes up:
>>
>> "An error as occured in pgAdmin II:basActions.drop:
>>
>> Number: -2147467259
>
>> Description: ERROR: DROP DATABASE: database "pgsql" is being accessed
>> by other users
>
>Are there any connections to it on the server? You can check with ps.
>
>> Another thing I need help with is the appearance of both "template0"
>> as well as "template1". I can't seem to delete template0 because the
>> error from the drop action informs me that it is marked as a template.
>
>Deleting template0 or template1 (unless you're just going to recreate it
>from template0) is a bad idea. They're the template databases from which
>new databases are created (IIRC, template0 is just system things and
>template1 can include anything you want to be clone in newly created
>databases - such as language handlers, or wahtever).
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Daniel Rubio 2003-03-31 15:32:16 Sizes for all databases
Previous Message lists 2003-03-31 14:19:02 Re: pg_restore problem