File : kdesupport/akonadi/server/src/storage/entities.xslChanges description :
* Check if the value is null before setting it in the entity constructor, to avoid unexpected results (at least with postgresql)

retrieveFiltered method: if using postgresql, when filtering by a reference column and null value, use ‘is null’ instead of ‘ = 0’

insert method: – add ‘returning id’ option when using postgresql to get the inserted id
– not insert 0 or null references values
– get the inserted id manually when using postgresql ( i cannot make DataStore::lastinsertid work )

QSqlQuery->lastInsertId does not work with postgresql (at least i can’t make it work, with or without oids 😦 ),
so using ‘returning id’ in the insert sentence we can get it with
insertId = query.record().value(QLatin1String(“id”)).toLongLong(&ok);

kdesupport/akonadi/server/src/handler/aklist.cpp
To retrieve all collections without parent