LoginSignup
0
0

More than 5 years have passed since last update.

Ubuntu にPostgreSQLを用意する

Last updated at Posted at 2013-03-21

7つのデータベース 7つの世界 に習うため
Ubuntu 12.10 にPostgreSQL を用意する.
実際のDB運用までは考慮しないので,
パッケージを入れて本に従って動かせれば良しとしておく :)
パッケージではPostgreSQL 9.1 が標準らしい.

$ sudo apt-get install postgresql postgresql-client psotgresql-contrib

動作するか確認のため,本のP.10 に従いテーブルを作成してみる.

$ sudo su - postgres
$ createdb book
$ psql book -c "SELECT '1'::cube"

ERROR:  type "cube" does not exist
LINE 1: SELECT '1'::cube;

拡張していないためエラーが出るので,下記のように拡張を追加.
4つめのcube がこのクエリに対応している.

$ psql book -c "CREATE EXTENSION tablefunc" 
$ psql book -c "CREATE EXTENSION fuzzystrmatch" 
$ psql book -c "CREATE EXTENSION pg_trgm" 
$ psql book -c "CREATE EXTENSION cube" 
$ psql book -c "CREATE EXTENSION dict_xsyn" 

再確認してみると無事に結果が返ってきた.

$ psql book -c "SELECT '1'::cube;"
 cube 
------
 (1)
(1 row)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0