PostgreSQL
OGo & PostgreSQL 8.3
Submitted by awilliam on Tue, 2008-02-19 00:55. OpenGroupware | PostgreSQLPostgreSQL 8.3 not longer performs automatic casting of INT to TEXT when INTs are compared to character types. This change is documented in the release notes. This change causes a database exception to occur in OpenGroupare's ACL processing. The specific error is:
ERROR: IN types character varying and integer cannot be matched
ACL queries like the following cause the exception because they contain a condition that compares string value to an array of integers: auth_id IN ( 9981, 9991,... where auth_id is a VARCHAR(255) value.
Improvement to SOPE's PostgreSQL Adaptor
Submitted by awilliam on Sat, 2008-02-09 21:54. OpenGroupware | PostgreSQLDo you have lots of errors like:
Feb 17 20:39:28 ogo-zidestore-1.5 [14569]: ERROR(+[NSCalendarDate(PostgreSQL72Values) valueFromCString:length:postgreSQLType:attribute:adaptorChannel:]): unexpected string '2007-03-13 15:38:41.420456+00' for date type 'DATE', returning now (expected format: '2001-07-26 14:00:00+02')
in your ZideStore error log? This is because the time & date parser in SOPE's PostreSQL adaptor didn't understand the milliseconds portion of the value. As of SOPE r1601 this should be corrected. SOPE now just ignores the millisecond value. See the diff for details.
Partial Indexes
Submitted by awilliam on Tue, 2007-04-24 22:01. OpenGroupware | PostgreSQLPostgreSQL supports an often overlooked feature called "Partial Indexes"; this allows you to have an index with a WHERE clause just like in a SELECT statement. With a partial index the querying for records with a frequently used key can be greatly accelerated; records without that key value can be immediately discarded.
From the PostgreSQL documentation: Since a query searching for a common value (one that accounts for more than a few percent of all the table rows) will not use the index anyway, there is no point in keeping those rows in the index at all. This reduces the size of the index, which will speed up queries that do use the index.

