ファイルを保存するデータベースを用意します。
[postgres@example2 postgres]$ createdb -E UTF-8 userdic
CREATE DATABASE
[postgres@example2 postgres]$ psql userdic
Welcome to psql 8.0.3, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
userdic=# create table user_dic (
userdic=# id integer,
userdic=# midasi text,
userdic=# hatuon text,
userdic=# yaku text,
userdic=# yorei text,
userdic=# useragent text,
userdic=# reg_date timestamp
userdic=# );
userdic=# REVOKE ALL ON TABLE user_dic FROM PUBLIC;
userdic=# ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_pkey PRIMARY KEY (id);
userdic=# ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_midasi_key UNIQUE (midasi);
userdic=# GRANT SELECT, INSERT, DELETE, UPDATE ON user_dic TO nobody;
CREATE TABLE
REVOKE
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "user_dic_pkey" for table "user_dic"
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "user_dic_midasi_key" for table "user_dic"
GRANT
userdic=# \q
テーブルの中身。
create table user_dic (
id integer,
midasi text,
hatuon text,
yaku text,
yorei text,
useragent text,
reg_date timestamp
);
REVOKE ALL ON TABLE user_dic FROM PUBLIC;
ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_pkey PRIMARY KEY (id);
ALTER TABLE ONLY user_dic ADD CONSTRAINT user_dic_midasi_key UNIQUE (midasi);
GRANT SELECT, INSERT, DELETE, UPDATE ON user_dic TO nobody;