Обсуждение: pgAdmin II questions

Поиск
Список
Период
Сортировка

pgAdmin II questions

От
"Tamir Halperin"
Дата:
I just finished upgrading from FreeBSD 4.6 to 4.8RC and I'm trying to do some things with pgAdmin II which are giving
meproblems. 

I remember creating a db called taxcal and it's listed there. However, I don't remember creating a db called pgsql.

Is this a db that the postgresql needs or was it created by mistake, maybe as a result of an erroneous create command?

Also, I can't drop it (by right clicking on it and selecting drop object from the shortcut menu. After being warned
thatthe 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

Another thing I need help with is the appearance of both "template0" as well as "template1". I can't seem to delete
template0because the error from the drop action informs me that it is marked as a template. 


Re: pgAdmin II questions

От
Stephan Szabo
Дата:
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).


Re: pgAdmin II questions

От
Andrew Biagioni
Дата:
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@megazone23.bigpanda.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
>
>


Re: pgAdmin II questions

От
Dmitry Morozovsky
Дата:
On Sun, 30 Mar 2003, Tamir Halperin wrote:

[please wrap your long lines]

TH> Another thing I need help with is the appearance of both "template0" as
TH> well as "template1". I can't seem to delete template0 because the error
TH> from the drop action informs me that it is marked as a template.

template1 is the database which is used when you do 'create database'; all
custom modifications, such as new data types, languages, etc, are copied to the
database you create

template0 is just copy of the _default_ template1 and is created by initdb, and
then marked 'no connects to me please'. Its existense is mainly for emergency
purposes.


Sincerely,
D.Marck                                   [DM5020, DM268-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru ***
------------------------------------------------------------------------