Ostatnio I went into trouble próbuje użyć hstore z Django. Zainstalowałem hstore ten sposób:Jak utworzyć nową bazę danych z zainstalowanym rozszerzeniem hstore?
$ sudo -u postgres psql
postgres=# CREATE EXTENSION hstore;
WARNING: => is deprecated as an operator name
DETAIL: This name may be disallowed altogether in future versions of PostgreSQL.
CREATE EXTENSION
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+--------------------------------------------------
hstore | 1.0 | public | data type for storing sets of (key, value) pairs
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(2 rows)
I naiwnie myślał, że moje nowe bazy danych będzie zawierać hstore. Tak nie jest:
$ createdb dbtest
$ psql -d dbtest -c '\dx'
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(1 row)
Czy istnieje sposób automatycznego posiadania hstore w nowo utworzonej bazie danych?
+1 za poprawność i umieszczenie wszystkiego w przydatnym formacie. Można rozważyć użycie innej bazy danych niż "template1". Każda baza danych może służyć jako szablon: 'CREATE DATABASE foo TEMPLATE mytemplate'. Lub, gdy masz dodatkowe rzeczy w 'template1', możesz użyć (domyślnie puste)' template0'. –