londonwebnerd / myroundcube

Automatically exported from code.google.com/p/myroundcube
0 stars 0 forks source link

[tasklist] - PostgreSQL issue if task status is empty #771

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Token: 5e57a38abd0d14627d89a9b1c0d01da3 (Don't modify this token!)
Version: 1.0.19 (18-01-2015)
PHP: 5.6.4
RCMAIL: 1.0.4
Database: pgsql
SERVER: Apache
----
I.  Issue Description:
Editing a task, created without status produces a database error:
-- snip
[21-Jan-2015 03:51:13 +0100]: DB Error: [7] FEHLER:  Operator existiert nicht: 
integer ~~ unknown
LINE 3:                  AND (parent_id LIKE '14%')
                                        ^
HINT:  Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen 
überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen 
hinzufügen. (SQL Query: SELECT task_id AS id FROM vtodo
                 WHERE tasklist_id IN ('9')
                 AND (parent_id LIKE '14%')
                 AND del = 0) in /var/www/webmail.oopen.de/roundcubemail-1.0.4/program/lib/Roundcube/rcube_db.php on line 467 (POST /?_task=tasks&_action=refresh?_task=&_action=)
-- snap

That's, because the "LIKE' operator does not work in conjunction with integer 
values (at least at PostgreSQL)

II. Steps to reproduce the Issue:
1. Create a task, let status select field untouched.
2. Click on "Flagged" field 
3.

Original issue reported on code.google.com by ch.kuche...@gmail.com on 21 Jan 2015 at 2:57

GoogleCodeExporter commented 9 years ago
Seems, tha the database driver tasklist_database_driver.php is broken (lines 
516, 1026 and 1035).

Original comment by ch.kuche...@gmail.com on 21 Jan 2015 at 3:12

GoogleCodeExporter commented 9 years ago

Original comment by roland.l...@gmail.com on 21 Jan 2015 at 4:49

GoogleCodeExporter commented 9 years ago
Sorry, but this patch does not solve my problem, but added another one. Now I 
cannot change any task.

I figured out, that the original error is not concerning task, its an error 
concerning SQL query (and mybe PostgrSQL). parent_id has type integer, but the 
LIKE operator works on string values.

this happens 3 times on source tasklist_database_driver.php. A workaround for 
postgreSQL is to make a cast on parent_id's type, means replacing
   .. parent_id LIKE ..
with
   .. parent_id::text LIKE ..

I wonder, if using "=" instead of "Like" is possible. I'm not shure, i think 
doing that way, the SQL query works on both: MySQL and PostgeSQL

Sorry about my bad english,

best wishes
Christoph

Original comment by ch.kuche...@gmail.com on 21 Jan 2015 at 1:46

GoogleCodeExporter commented 9 years ago
I have tested it on our test system (PostgreSQL 9.1) and my patch works for me.

Please post the full error log entry.

Original comment by myroundc...@gmail.com on 21 Jan 2015 at 1:54

GoogleCodeExporter commented 9 years ago
saving a (existing) task failed with that error:

[21-Jan-2015 15:40:20 +0100]: DB Error: [7] FEHLER:  Syntaxfehler bei „IN“
ZEILE 2: ...   SET changed = '2015-01-21 15:40:20' , "status"=IN-PROCESS...
                                                              ^ (SQL Query: UPDATE vtodo
        SET changed = '2015-01-21 15:40:20' , "status"=IN-PROCESS, "recurrence_id"='0', "title"='Test Aufgabe 1', "description"='Neue Testaufgabe 1', "flagged"='0', "complete"='0', "parent_id"=NULL, "uid"='11C07B1A1EEA85FB9271DC9BDF77A7A0-1E0F17A4EE53FA70', "date"='2015-01-22', "time"='00:00', "startdate"='2015-01-21', "starttime"='00:00', "alarms"='-1H:EMAIL', "recurrence"=NULL, "exception"=NULL, "exdate"=NULL, "tags"='', "notify"=NULL
        WHERE task_id = '30'
        AND tasklist_id IN ('1')) in /var/www/webmail2.oopen.de/roundcubemail-1.0.4/program/lib/Roundcube/rcube_db.php on line 467 (POST /?_task=tasks&_action=task?_task=&_action=)

Original comment by ch.kuche...@gmail.com on 21 Jan 2015 at 2:43

GoogleCodeExporter commented 9 years ago
It looks like I just missed the quotes in my patch. Please check again in a few 
for an update.

Original comment by myroundc...@gmail.com on 21 Jan 2015 at 2:45

GoogleCodeExporter commented 9 years ago
Hint:

In the SQL Update statement, if i change
  .. "status"=IN-PROCESS ..
to
  .. "status"='IN-PROCESS' ..
i can update database in the database minitor.

Original comment by ch.kuche...@gmail.com on 21 Jan 2015 at 2:54

GoogleCodeExporter commented 9 years ago
sorry, i don't saw yoer post - thank you very much

Original comment by ch.kuche...@gmail.com on 21 Jan 2015 at 2:56