[horde] Horde activesync error with postgresql

Jos van der Woude jos at veerkade.com
Wed Mar 1 08:14:50 UTC 2017


  Hi list,

As of this morning ActiveSync is throwing the following error while  
syncing horde mail on my iphone. Worked like a charm till yesterday.

I did update the latest packages yester day using pear, so it most  
likely something there is causing this error?

I am using Fedora 25, fully up to date (so, yes php 7.0.16, with a  
Postgresql database, 9.5.6) and Horde Groupware Webmail edition 5.2.17

Relevant lines horde.log:

Mar  1 08:02:01 servix HORDE: Returning HTTP 500 while handling Sync  
command. Error is: SQLSTATE[55000]: Object not in prerequisite state:  
7 ERROR:  lastval is not yet defined in this session [pid 23450 on  
line 160 of
   "/var/www/html/mail/horde/rpc.php"]
  Mar  1 08:02:01 servix HORDE: Error in communicating with ActiveSync  
server: SQLSTATE[55000]: Object not in prerequisite state: 7 ERROR:  
 lastval is not yet defined in this session [pid 23450 on line 165 of  
"/usr/share/pear/Horde/Rpc/ActiveSync.php"]
  Mar  1 08:02:01 servix HORDE: #0  
/usr/share/pear/Horde/ActiveSync/State/Sql.php(411):  
Horde_Db_Adapter_Pdo_Base->insertBlob('horde_activesyn...',  
Array)#012#1 /usr/share/pear/Horde/ActiveSync/Request/Sync.php(565):  
Horde_ActiveSync_State_Sql->save()#012#2  
/usr/share/pear/Horde/ActiveSync/Request/Base.php(253):  
Horde_ActiveSync_Request_Sync->_handle()#012#3  
/usr/share/pear/Horde/ActiveSync.php(834):  
Horde_ActiveSync_Request_Base->handle()#012#4  
/usr/share/pear/Horde/Rpc/ActiveSync.php(143):  
Horde_ActiveSync->handleRequest('Sync', 'Q99H2G7NM95CFA5...')#012#5  
/var/www/html/mail/horde/rpc.php(160):  
Horde_Rpc_ActiveSync->getResponse(NULL)#012#6 {main} [pid 23450 on  
line 165 of "/usr/share/pear/Horde/Rpc/ActiveSync.php"]
  Mar  1 08:02:01 servix HORDE: Buffer contents: #003#001j

Relevant lines Postgresql.log:
      Mar  1 08:02:01 servix postgres[23451]: [3-1] ERROR:  lastval is  
not yet defined in this session
    Mar  1 08:02:01 servix postgres[23451]: [3-2] STATEMENT:  SELECT LASTVAL()
     

I did a little research into this error, and found this:


http://stackoverflow.com/questions/6794378/postgresql-curval-not-working-using-php-pdo:
 From the fine manual[1]:

> currval
> Return the value most recently obtained by nextval for this sequence  
> in the current session. (An error is reported if nextval has never  
> been called for this sequence in this session.) Because this is  
> returning a session-local value, it gives a predictable answer  
> whether or not other sessions have executed nextval since the  
> current session did.

You use currval to get the /last/ value that was pulled out of the  
sequence /in the current session/. The usual pattern is to do an  
INSERT that uses a sequence and then you call currval to figure out  
what value the INSERT used. If you haven't called nextval with the  
sequence in question in the current session then there is nothing  
for currval to return. 

Could this be the cause of this error? 
Unfortunateliy, I am not versed well enough in this code to attempt a  
fix myself.

Any suggestions?

Regards
Jos
 


Links:
------
[1] http://www.postgresql.org/docs/current/static/functions-sequence.html

-- 
This message has been scanned for viruses and dangerous content by
MailScanner at the Veerkade Network and is believed to be clean.



More information about the horde mailing list