<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Wyczyszczenie Database]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=591&amp;type=atom"/>
	<updated>2011-05-20T21:30:29Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=591</id>
		<entry>
			<title type="html"><![CDATA[Odp: Wyczyszczenie Database]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2520#p2520"/>
			<content type="html"><![CDATA[Nie wnikając za bardzo w szczegóły taka nazwa nie jest poprawnym identyfikatorem SQL, czyli każde jej odwołanie powinno odbywać się przez znaki cudzysłowu (ang. quoted identifier).

[code]dropdb -ei "PT3 DB"
Database "PT3 DB" will be permanently removed.
Are you sure? (y/n) y
DROP DATABASE "PT3 DB";
dropuser kiv[/code]

[url]http://www.postgresql.org/docs/9.0/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS[/url]

Jeśli chodzi o sprawdzenie nazwy bazy, to można np. nawiązać sesję psql jako superużytkownik i użyć meta-polecenia \l albo bezpośrednio odwołać się do katalogu [url]pg_database[/url]:

[code]\l
        List of databases
   Name    |  Owner   | Encoding 
-----------+----------+----------
 PT3 DB    | kiv      | UTF8
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8
(4 rows)

SELECT datname FROM pg_database WHERE datdba = (SELECT oid FROM pg_authid WHERE rolname = 'kiv');
 datname 
---------
 PT3 DB
(1 row)[/code]]]></content>
			<author>
				<name><![CDATA[gszpetkowski]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1223</uri>
			</author>
			<updated>2011-05-20T21:30:29Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2520#p2520</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Wyczyszczenie Database]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=2519#p2519"/>
			<content type="html"><![CDATA[Cześć, używam ubuntu.

Chce wyczyścić (usunąć jedną database).
Jednak terminal odmawia posłuszeństwa:

Jak to robię:

sudo su
su postgres

Chce usunąć użytkownika wraz z bazą:

wpisuje
postgres@dupek-Latitude-D400:/home/dupek$ dropuser kiv

Wywala mi ta databaza zależy od tego użytkownika
dropuser: removal of role "kiv" failed: ERROR:  role "kiv" cannot be dropped because some objects depend on it
DETAIL:  owner of database PT3 DB
51 objects in database PT3 DB

Więc z tego co tu jest napisane wnioskuje, że database nazywa się PT3 DB
(nie wiem jak inaczej moge sprawdzic nazwe tej bazy)
więc wpisuje:
postgres@dupek-Latitude-D400:/home/dupek$ dropdb -i -e PT3 DB

Wywala mi, że nie istnieje.
Próbowałem z:
postgres@dupek-Latitude-D400:/home/dupek$ dropdb -i -e PT3
postgres@dupek-Latitude-D400:/home/dupek$ dropdb -i -e PT3_dB
postgres@dupek-Latitude-D400:/home/dupek$ dropdb -i -e PT3DB



Jak to usunąć ?]]></content>
			<author>
				<name><![CDATA[yooozel]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=1236</uri>
			</author>
			<updated>2011-05-20T20:32:24Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=2519#p2519</id>
		</entry>
</feed>
