[pgsql-jp: 34302] Re: データベースが存在するのに、「存在しない」と言われる

Yukie Oshima sanoyuki @ ninus.ocn.ne.jp
2004年 11月 19日 (金) 15:59:19 JST


皆様、いろいろとヒントをありがとうございます。
質問者の大島です。

私も、同じ名前のデータベースが2つあって、なおかつオーナーが
ないのがおかしいなとおもっていたのですが、オーナーがなかった
ことの原因はわかりました。

もともと cart04 は yukie というユーザで作成していまして、
cart04 に接続できなく、おかしいなとおもってから、dropuser したり
initdb したりと、いろいろためしている間に、yukie という ユーザを
消したまま、psql -l をおこなった結果だったので、あのように
オーナーが空白になっていました。

ですので、また yukie というオーナーをつくり、その yukie で
dropdb cart04 を実行しましたが、やはり cart04 は存在しなと
いわれてしまいます。

以下、createuser yukie のあとの psql -l の結果と select * from pg_database
の結果を添付いたします。

お気づきの点等ありましたら、ご指摘いただけると幸いです。

[postgres @ fedora pgsql]$ createuser yukie
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
[postgres @ fedora pgsql]$ su - yukie
Password:
ksh: /etc/bashrc[47]: shopt: not found
$ psql -l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
cart04 | yukie | EUC_JP
cart04 | yukie | EUC_JP
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
test | postgres | SQL_ASCII
(5 rows)

$ dropdb cart04
ERROR: database "cart04" doesn't exist despite earlier reports to the
contrary
dropdb: database removal failed: ERROR: database "cart04" doesn't exist
despite earlier reports to the contrary
$ exit
[postgres @ fedora pgsql]$ psql template1
Welcome to psql 7.4.3, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

template1=# select * from pg_database;
datname | datdba | encoding | datistemplate | datallowconn |
datlastsysoid | datvacuumxid | datfrozenxid | datpath | datconfig | datacl
-----------+--------+----------+---------------+--------------+---------------+--------------+--------------+---------+-----------+--------------------------
cart04 | 100 | 1 | f | t | 17140 | 464 | 464 | | |
cart04 | 100 | 1 | f | t | 17140 | 464 | 464 | | |
test | 1 | 0 | f | t | 17140 | 464 | 464 | | |
template1 | 1 | 0 | t | t | 17140 | 464 | 464 | | | {postgres=C*T*/postgres}
template0 | 1 | 0 | t | f | 17140 | 464 | 464 | | | {postgres=C*T*/postgres}
(5 rows)

template1=#


tome34 wrote:

>>createdbをしたら、createuserをしましょう。
>>多分、postgresのスーパーユーザーだけしか
>>存在しないものとおもわれます。
>>
>>この場合、create tableで表を作っても、オーナーが決まっていないので
>>誰もアクセスできないテーブルができたように思います。
>>    
>>
>
>と言うことは、そのスーパーユーザーでcreatedbするわけですから
>Ownerはpostgresになると思いますが?
>しかもそのpostgresからはアクセス出来る筈では?
>違ってますでしょうか?????
>
>
>
>
>  
>




pgsql-jp メーリングリストの案内