6.0.0-git
2021-01-18

[#10346] Syntax error in Horde_ActiveSync_State_History->listDevices()
Summary Syntax error in Horde_ActiveSync_State_History->listDevices()
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester botner (at) univention (dot) de
Created 2011-07-15 (3475 days ago)
Due
Updated 2011-07-22 (3468 days ago)
Assigned 2011-07-19 (3471 days ago)
Resolved 2011-07-22 (3468 days ago)
Milestone
Patch No

History
2011-07-22 17:22:16 Michael Rubinsky Comment #7
State ⇒ Resolved
Reply to this comment
Fixed, thanks.
2011-07-22 17:08:21 Git Commit Comment #6 Reply to this comment
Changes have been made in Git for this ticket:

[mjr] use AS in column aliases to make postgres happy (Bug #10346).

  3 files changed, 4 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/9828418c8462b553011def736ec9a81a8d0b2238
2011-07-20 07:14:26 botner (at) univention (dot) de Comment #5 Reply to this comment
No, there is no comma missing and it's not ambiguous. "device_id" is 
a column alias for "d.device_id". We don't want two columns of 
device_id returned (they are the same value). It's used so the 
returned data is keyed as "device_id" and not "d.device_id". 
However, maybe postgres doesn't like the alias to be named the same 
as a column name.
ah, ok, the problem is that postgres requires AS when specifying alias 
names for output columns

-> SELECT d.device_id AS device_id, device_type, device_agent, ...
2011-07-19 14:20:42 Michael Rubinsky Comment #4
State ⇒ Assigned
Reply to this comment
It seems there is a comma missing and the column reference 
"device_id" is ambiguous, something like this works:
No, there is no comma missing and it's not ambiguous. "device_id" is a 
column alias for "d.device_id". We don't want two columns of device_id 
returned (they are the same value). It's used so the returned data is 
keyed as "device_id" and not "d.device_id". However, maybe postgres 
doesn't like the alias to be named the same as a column name.
- SELECT d.device_id device_id, device_type, device_agent, 
device_policykey,  ...
+ SELECT d.device_id, u.device_id, device_type, device_agent, 
device_policykey,  ...
2011-07-19 14:11:47 botner (at) univention (dot) de Comment #3 Reply to this comment
What RDBMS is this?  I'm guessing it doesn't like aliasing the 
d.device_id column name with the same name as the column (device_id)?
The rdbms is PostgreSQL.

It seems there is a comma missing and the column reference "device_id" 
is ambiguous, something like this works:

- SELECT d.device_id device_id, device_type, device_agent, 
device_policykey,  ...
+ SELECT d.device_id, u.device_id, device_type, device_agent, 
device_policykey,  ...

2011-07-19 13:43:25 Michael Rubinsky Comment #2
Assigned to Michael Rubinsky
State ⇒ Feedback
Reply to this comment
What RDBMS is this?  I'm guessing it doesn't like aliasing the 
d.device_id column name with the same name as the column (device_id)?
2011-07-15 12:56:51 botner (at) univention (dot) de Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ Syntax error in Horde_ActiveSync_State_History->listDevices()
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
    * logged in as a admin user on the horde webclient
    * clicked on "Administration" -> "ActiveSync Devices"

Then i got the following error message:

A fatal error has occurred
SQLSTATE[42601]: Syntax error: 7 FEHLER: Syntaxfehler bei »device_id« 
LINE 1: SELECT d.device_id device_id, device_type, device_agent, 
dev... ^

1. Horde_ActiveSync_State_History->listDevices() 
/usr/share/horde4/admin/activesync.php:58

Details
The full error message is logged in Horde's log file, and is shown 
below only to administrators. Non-administrative users will not see 
error details.

Horde_ActiveSync_Exception Object
(
     [_previous:private] => Horde_Db_Exception Object
         (
             [_previous:private] =>
             [details] =>
             [message:protected] => SQLSTATE[42601]: Syntax error: 7 
FEHLER:  Syntaxfehler bei »device_id«
LINE 1: SELECT d.device_id device_id, device_type, device_agent, dev...
                            ^
             [string:private] =>
             [code:protected] => 42601
             [file:protected] => /usr/share/php/Horde/Db/Adapter/Base.php
             [line:protected] => 556
             [trace:private] => Array
                 (
                     [0] => Array
                         (
                             [file] => 
/usr/share/php/Horde/Db/Adapter/Pdo/Base.php
                             [line] => 83
                             [function] => execute
                             [class] => Horde_Db_Adapter_Base
                             [type] => ->
                             [args] => Array
                                 (
                                     [0] => SELECT d.device_id 
device_id, device_type, device_agent, device_policykey, 
device_rwstatus, device_user FROM horde_activesync_device d INNER JOIN 
horde_activesync_device_users u ON d.device_id = u.device_id
                                     [1] => Array
                                         (
                                         )

                                     [2] =>
                                 )

                         )

                     [1] => Array
                         (
                             [file] => 
/usr/share/php/Horde/ActiveSync/State/History.php
                             [line] => 561
                             [function] => selectAll
                             [class] => Horde_Db_Adapter_Pdo_Base
                             [type] => ->
                             [args] => Array
                                 (
                                     [0] => SELECT d.device_id 
device_id, device_type, device_agent, device_policykey, 
device_rwstatus, device_user FROM horde_activesync_device d INNER JOIN 
horde_activesync_device_users u ON d.device_id = u.device_id
                                     [1] => Array
                                         (
                                         )

                                 )

                         )

                     [2] => Array
                         (
                             [file] => /usr/share/horde4/admin/activesync.php
                             [line] => 58
                             [function] => listDevices
                             [class] => Horde_ActiveSync_State_History
                             [type] => ->
                             [args] => Array
                                 (
                                 )

                         )

                 )

         )

     [details] =>
     [message:protected] => SQLSTATE[42601]: Syntax error: 7 FEHLER:   
Syntaxfehler bei »device_id«
LINE 1: SELECT d.device_id device_id, device_type, device_agent, dev...
                            ^
     [string:private] =>
     [code:protected] => 42601
     [file:protected] => /usr/share/php/Horde/ActiveSync/State/History.php
     [line:protected] => 563
     [trace:private] => Array
         (
             [0] => Array
                 (
                     [file] => /usr/share/horde4/admin/activesync.php
                     [line] => 58
                     [function] => listDevices
                     [class] => Horde_ActiveSync_State_History
                     [type] => ->
                     [args] => Array
                         (
                         )

                 )

         )

)

Saved Queries