「PostgreSQLパッチ」の編集履歴(バックアップ)一覧はこちら
PostgreSQLパッチ - (2005/10/15 (土) 17:34:31) の最新版との変更点
追加された行は緑色になります。
削除された行は赤色になります。
*PostgreSQLでDB環境を設定
** DBユーザ作成
# su - postgres
$ createuser -P roundcube
Enter password for user "roundcube": ******
Enter it again: ******
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) y
CREATE USER
** DB作成
$ createdb -U roundcube -O roundcube roundcube
createdb
$ psql -l
List of databases
Name | Owner | Encoding
--------------+--------------+----------
roundcube | roundcube | EUC_JP
** 初期テーブル定義
$ psql -U roundcube roundcube < SQL/postgres.initial.sql
*PostgreSQLパッチ
- RoundCubeは、MySQLが開発のメインとなっているようです。
- PostgreSQLで使うには、いわゆるMyGresパッチ作業が必要です(注:MyGresは桑村さんから教えていただきました)。
- RoundCubeは、エラーの内容が、logsディレクトリにerrorsファイルへ吐き出される。PHPのログファイルも合わせてデバッグ作業をおこなう。
- もちろん、PostgreSQLのログファイルもチェックしよう。
** PostgreSQLパッチ(2005.12.24)
- messageテーブル変更
-- from/cc/toで、「too long」が出た。text型へ変更
--
-- Table "messages"
-- Name: messages; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE "messages" (
message_id integer DEFAULT nextval('message_ids'::text) NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
del integer DEFAULT 0 NOT NULL,
cache_key character varying(128) DEFAULT ''::character varying NOT NULL,
idx integer DEFAULT 0 NOT NULL,
uid integer DEFAULT 0 NOT NULL,
subject text DEFAULT '',
"from" text DEFAULT '',
"to" text DEFAULT '',
cc text DEFAULT '',
date timestamp with time zone NOT NULL,
size integer DEFAULT 0 NOT NULL,
headers text NOT NULL,
body text
);
** PostgreSQLパッチ情報(2005.10.15)
- [[Discussion Forums: RoundCube Webmail PostgreSQL>http://sourceforge.net/forum/forum.php?thread_id=1367464&forum_id=501758]]
// - [[sf.net [1326324] pgsql necessary patch>
** PostgreSQLパッチの数々
*** UNIX_TIMESTAMP()関数の問題 (2005-10-14)
- PostgreSQLのデフォルトではUNIX_TIMESTAMP関数は無い。
- ディスカッションサイトでは2通り紹介されている。
- 1. PHPソースをパッチ
- SELECT vars, ip, UNIX_TIMESTAMP(changed) AS changed
+ SELECT vars, ip, extract(epoch from changed) AS changed
- 2. 無ければ、RoundCube用に関数を作る(力技)
create or replace function unix_timestamp
(timestamp with time zone) time zoneがある場合
returns int as '
declare
date alias for $1;
timezero timestamp;
offset interval;
begin
timezero := timestamp ''1970-1-1 00:00'' at time zone ''utc'';
offset := date-timezero;
return (
extract(''days'' from offset)*86400+
extract(''hours'' from offset)*3600+
extract(''minutes'' from offset)*60+
extract(''seconds'' from offset))::int;
end;
' language 'plpgsql';
*** エスケープ文字が無いバグ(2005-10-15)
- SELECT identity_id, name, email
FROM identities
WHERE user_id=1 AND del!='1'
ORDER BY "default" DESC, name ASC
+ SELECT identity_id, name, email
FROM identities
WHERE user_id=1 AND del!='1'
ORDER BY \"default\" DESC, name ASC
- パッチは2箇所
program\steps\mail\compose.inc(94): ORDER BY `default` DESC, name ASC",
program\steps\settings\func.inc(151): ORDER BY `default` DESC, name ASC",
***PHP文法ミス
- roundcubemail/program/include/rcube_db.inc
@@ -169,7 +169,7 @@
- $result =& $this->db_handle->getOne("SELECT CURRVAL('" .$sequence. "')");
+ $result =& $this->db_handle->getOne("SELECT CURRVAL('$sequence')");