Hi,
I'd like to store my roundcube data in pgsql, but not in the schema PUBLIC but some other, e.g. ROUNDCUBE.
I fail to log into the correct schema when giving the following syntax in db.inc.php:
pgsql://username:password@localhost/database?schema=ROUNDCUBE
Any idea on how to succeed in logging into the schema?
Best Regards
Dirk _______________________________________________ List info: http://lists.roundcube.net/users/
On Fri, 23 Apr 2010 22:06:22 +0200, "Dirk F. Raetzel" d00443@spaetzle.de wrote:
pgsql://username:password@localhost/database?schema=ROUNDCUBE
Any idea on how to succeed in logging into the schema?
Try to add schema prefix in all db_table_* and db_sequence_* options.
A.L.E.C wrote:
On Fri, 23 Apr 2010 22:06:22 +0200, "Dirk F. Raetzel" wrote:
pgsql://username:password@localhost/database?schema=ROUNDCUBE
Any idea on how to succeed in logging into the schema?
Try to add schema prefix in all db_table_* and db_sequence_* options.
This is not working, as it won't change the search path vor pgsql.
If you for example do
INSERT INTO myschema.users ...
then implicitly sequence user_ids will be searched to generate a new user_id, but pgsql will not find it, as it only looks in the default search_path (usually 'public'). RC is not explicitly referencing the sequence.
A workaround is to change program/include/rcube_mdb2.php and add in function dsn_connect just before the final return statement:
$dbh->query("SET search_path TO myschema");
Dirk _______________________________________________ List info: http://lists.roundcube.net/users/
On 24.04.2010 15:53, Dirk F. Raetzel wrote:
Try to add schema prefix in all db_table_* and db_sequence_* options.
This is not working, as it won't change the search path for pgsql.
If you for example do
INSERT INTO myschema.users ...
then implicitly sequence user_ids will be searched to generate a new user_id, but pgsql will not find it, as it only looks in the default search_path (usually 'public'). RC is not explicitly referencing the sequence.
This is working for me, and this definetly should work if you create tables using sequence names with schema name (in CREATE TABLE).
psql (8.4.3)
testdb=# CREATE SEQUENCE test.test_id; CREATE SEQUENCE testdb=# CREATE TABLE test.test (id integer default nextval('test.test_id'), t text); CREATE TABLE testdb=# INSERT INTO test.test (t) VALUES('a'); INSERT 0 1 testdb=# SELECT * FROM test.test; id | t ----+--- 1 | a (1 row)
ps. next thing I'll work on will be replace of all db_table_*/db_sequence_* options with one db_prefix option.