PostgreSQL, SQLite
Database independence
As PostgreSQL was not working on 2009-10-08, database independence was dropped for 4.0 and 5.0, so MySQL only. It is possible it will be reintroduced in 6.0 though, if it works. However, this is unlikely because of the massive work involved.
Reference:
http://article.gmane.org/gmane.comp.cms.tiki.devel/13906
Table of contents
Why Database independence?
Tiki uses a database abstraction layer so it can be used with many databases (PostgreSQL, SQLite) in addition to MYSQL. However, anything but MySQL is no longer officially supported.
We’re working on fixing remaining issues of bringing back the alternatives and although default installations are partly working, we can not yet guarantee a stable or bug-free usage of Tiki with databases other than MySQL.
You can expect other databases for later versions though.
Things to note and discuss
- MySQL search vs DB independent search (we’re using fulltext-indices which not all DBS support)
- Some code is using MySQL BLOB, whereas PostgreSQLs equivalent is BYTEA.
Now (old statement here) that we have a more flexible/powerful way to handle DB upgrades, we can use simpler SQL commands and put more logic in PHP. This can make DB independence simpler than before.
I will do something about it
If you want to help, please indicate your name below and which DB you would like to work on.| Name | Database | Comment |
| Marc Laporte | in general | no coding, but I can supply a test/dev server (ex.: postgresql.tikiwiki.org) Once Tiki works, I commit to putting at least one "Real World" project to Dogfood . |
| sylvieg | postgres | |
| luci | postgres | |
| soulhunter | PostgreSQL | I can do coding and testing. I definetelly will put a real world project: my own web will run on TikiWiki using PostgreSQL. |
| dthacker | postgreSQL, SQLite, Oracle | coding, testing and dog-fooding. Will also test with other databases (Informix, Firebird) |
| Kissaki | SQLite, PostgreSQL | I’ll do these 2! |
| vilam | SQLite | Testing SQLite3 with PDO and tw 4.1 :Dogfood (in French) |
How it works
SQL commands are added to db/tiki.sqldb/convertscripts/convertsqls.sh
It calls PHP executing the following scripts:
- db/convertscripts/mysql_to_pgsql.php
– MySQL to PosgreSQL
- db/convertscripts/mysql_to_sqlite.php
– MySQL to SQlite
- db/tiki-4.0-pgsql.sql
– PostreSQL install SQL
- db/tiki-4.0-sqlite.sql
– SQlite install SQL
Todo
Contact all developers and people that have reported bugs related to database independence to inform them of the impending deadline.Done 2009-06-08Identify maintainers- Monitor http://wiki.postgresql.org/wiki/TikiWiki_CMS/Groupware
- Get Tiki to install with various DBs
- Tiki 3.0 won't install with PostgreSQL http://demo.tikiwiki.org/postgresql/
- Trunk as of 2009-08-08 (Future 4.0) won't install http://db.tikiwiki.org/postgresql-trunk/tiki-install.php
(with Postgresql 7.4)
- Tiki 3.0 won't install with PostgreSQL http://demo.tikiwiki.org/postgresql/
- Fix bugs, especially in more important features
- update developer documentation, especially DbAbstractionDev (which dates from 2004! and needs to be moved to dev.tikiwiki.org) so developers don't introduce regressions
- Monitor commits
- Ideally have a script which can detect errors.
- Promote Tiki within the Database's community
- Make upgrade procedure also be DB independant
- Not directly related, but we need to complete the move to PDO (now in the code but not activated by default)
Links
PostgreSQL Wiki – Converting from MySQL to PostgreSQLDrupal was in a similar situation
Some Differences Between PostgreSQL + MySQL
(taken from an article by Joel Burton on wiki.postgresql.orgJoel Burton wrote:
In general, PostgreSQL makes a strong effort to conform to existing database standards, where MySQL has a mixed background on this. If you're coming from a background using MySQL or Microsoft Access, some of the changes can seem strange (such as not using double quotes to quote string values).
* MySQL uses nonstandard '#' to begin a comment line; PostgreSQL doesn't. Instead, use '--' (double dash), as this is the ANSI standard, and both databases understand it.
* MySQL uses ' or " to quote values (i.e. WHERE name = "John"). This is not the ANSI standard for databases. PostgreSQL uses only single quotes for this (i.e. WHERE name = 'John'). Double quotes are used to quote system identifiers; field names, table names, etc. (i.e. WHERE "last name" = 'Smith').
* MySQL uses ` (accent mark or backtick) to quote system identifiers, which is decidedly non-standard.
* PostgreSQL is case-sensitive for string comparisons. The field "Smith" is not the same as the field "smith". This is a big change for many users from MySQL and other small database systems, like Microsoft Access. In PostgreSQL, you can either:
** Use the correct case in your query. (i.e. WHERE lname='Smith')
** Use a conversion function, like lower() to search. (i.e. WHERE lower(lname)='smith')
** Use a case-insensitive operator, like ILIKE or *~
* Database, table, field and columns names in PostgreSQL are case-independent, unless you created them with double-quotes around their name, in which case they are case-sensitive. In MySQL, table names can be case-sensitive or not, depending on which operating system you are using.
* PostgreSQL and MySQL seem to differ most in handling of dates, and the names of functions that handle dates.
* MySQL uses C-language operators for logic (i.e. 'foo' || 'bar' means 'foo' OR 'bar', 'foo' && 'bar' means 'foo' and 'bar'). This might be marginally helpful for C programmers, but violates database standards and rules in a significant way. PostgreSQL, following the standard, uses || for string concatenation ( 'foo' || 'bar' = 'foobar').
* There are other differences between the two, such as the names of functions for finding the current user. MySQL has a tool, Crash-Me, which can useful for digging this out. (Ostensibly, Crash-Me is a comparison tool for databases; however, it tends to seriously downplay MySQL's deficiencies, and isn't very objective in what it lists: the entire idea of having procedural languages (a very important feature for many users!) is relegated to a single line on the bottom fifth of the document, while the fact that MySQL allows you to use || for logical-or (definitely non-standard), is listed way before this, as a feature. Be careful about its interpretations.)
* MySQL uses nonstandard '#' to begin a comment line; PostgreSQL doesn't. Instead, use '--' (double dash), as this is the ANSI standard, and both databases understand it.
* MySQL uses ' or " to quote values (i.e. WHERE name = "John"). This is not the ANSI standard for databases. PostgreSQL uses only single quotes for this (i.e. WHERE name = 'John'). Double quotes are used to quote system identifiers; field names, table names, etc. (i.e. WHERE "last name" = 'Smith').
* MySQL uses ` (accent mark or backtick) to quote system identifiers, which is decidedly non-standard.
* PostgreSQL is case-sensitive for string comparisons. The field "Smith" is not the same as the field "smith". This is a big change for many users from MySQL and other small database systems, like Microsoft Access. In PostgreSQL, you can either:
** Use the correct case in your query. (i.e. WHERE lname='Smith')
** Use a conversion function, like lower() to search. (i.e. WHERE lower(lname)='smith')
** Use a case-insensitive operator, like ILIKE or *~
* Database, table, field and columns names in PostgreSQL are case-independent, unless you created them with double-quotes around their name, in which case they are case-sensitive. In MySQL, table names can be case-sensitive or not, depending on which operating system you are using.
* PostgreSQL and MySQL seem to differ most in handling of dates, and the names of functions that handle dates.
* MySQL uses C-language operators for logic (i.e. 'foo' || 'bar' means 'foo' OR 'bar', 'foo' && 'bar' means 'foo' and 'bar'). This might be marginally helpful for C programmers, but violates database standards and rules in a significant way. PostgreSQL, following the standard, uses || for string concatenation ( 'foo' || 'bar' = 'foobar').
* There are other differences between the two, such as the names of functions for finding the current user. MySQL has a tool, Crash-Me, which can useful for digging this out. (Ostensibly, Crash-Me is a comparison tool for databases; however, it tends to seriously downplay MySQL's deficiencies, and isn't very objective in what it lists: the entire idea of having procedural languages (a very important feature for many users!) is relegated to a single line on the bottom fifth of the document, while the fact that MySQL allows you to use || for logical-or (definitely non-standard), is listed way before this, as a feature. Be careful about its interpretations.)
Some differences between adodb and pdo
- pdo implements ifnull only for mysql
- pdo does not implement the tiki logs
Automated testing
Alain Désilets wrote:
Note: It would also be nice to be able to use SQLite for automated testing purposes. A suite of automated tests typically needs to restore the DB to a pristine starting state several hundreds of time. With DBMS like MySQL, restoring the TIKi db can take something like 30 secs. With SQLite, it's about 5 secs (cause everything is in memory). Note that most of the time, the DB used for testing is very small and only contains a few objects and pages,so keeping it all in memory is not a problem..
Wishes
Open
| Rating | Subject | Priority | Category | Created | |
|---|---|---|---|---|---|
| Problem in adodb when using Chinese characters in browser title | 9 high | Bug: Usability | 2009-06 | ||
| Crash on a replication of site from Unix to Windows - and windows installation | 7 | Bug: conflict of two features (each works well independently) Bug: Error | 2010-02 | ||
| Scope operator to access PDO properties and methods for $Tikidb fails : execution fail wit php 3.3.1 | 7 | Bug: Consistency Bug: Error | 2010-03 | ||
| PostGres errors on attempted post/insert of long emails to forums with email-to-forum enabled | 1 low | Bug: Error | 2006-04 | ||
| Flat Files backend instead of DB (maybe ADOdb could do this?) | 1 low | Feature request | 2008-05 |
Pending
| Rating | Subject | Priority | Category | Created |
|---|
Closed
[+]Related
Contributors to this page: vilam
,
macnific
,
alain_desilets
,
Kissaki
,
dthacker
,
soulhunter
,
sylvie
,
luci
and
marclaporte
.
Page last modified on Tuesday 09 February, 2010 15:28:53 UTC by vilam
.
Sidebar
Sidebar
To register
To have an account at this site, please register at Tikiwiki.org
, and then use that user name and password to log in here.
Last Changed Items
- More granular control of recurring events in Calendar
- Users can't deleter his own account
- Add New User - Gen Password - Validate By Email is Broken in 4.1 and 4.2
- Email notification don't work except if "watch minor" is checked
- ssl_error_rx_record_too_long when using "Require Secure (HTTPS) login" (CPANEL self-signed cert.)

Last Comments