6.0.0-beta1
7/6/25

[#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 07/15/2011 (5105 days ago)
Due
Updated 07/22/2011 (5098 days ago)
Assigned 07/19/2011 (5101 days ago)
Resolved 07/22/2011 (5098 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/22/2011 05:22:16 PM Michael Rubinsky Comment #7
State ⇒ Resolved
Reply to this comment
Fixed, thanks.
07/22/2011 05:08:21 PM 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
07/20/2011 07:14:26 AM 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, ...
07/19/2011 02:20:42 PM 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,  ...
07/19/2011 02:11:47 PM 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,  ...

07/19/2011 01:43:25 PM Michael Rubinsky Comment #2
State ⇒ Feedback
Assigned to Michael Rubinsky
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)?
07/15/2011 12:56:51 PM botner (at) univention (dot) de Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Syntax error in Horde_ActiveSync_State_History->listDevices()
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
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