Query fails in Postgres

neilnz - May 5, 2008 - 05:51
Project:Shared Sign-On
Version:5.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

This query in singlesignon.module:

db_query("UPDATE {sessions} AS sess_slave LEFT JOIN {sessions} AS sess_master ON (sess_master.sid = '%s' AND sess_slave.sid = '%s') SET sess_slave.uid = sess_master.uid WHERE sess_slave.sid = '%s'", session_id(), $_GET['slave_session'], $_GET['slave_session']);

Fails in Postgres. In postgres < 8.2 you can't alias a table in an update, and in all versions you can't do a join. I agree it's nice to be able to do it the mysql way, but alas postgres is stuck in its ways sometimes. This works for me:

$result = db_query("SELECT uid FROM {sessions} WHERE sid = '%s'", session_id());
if ($master_uid = db_result($result)) {
db_query("UPDATE {sessions} SET uid = %d WHERE sid = '%s'", $master_uid, $_GET['slave_session']);
}

#1

wayland76 - May 6, 2008 - 01:01

Ok. I was planning to put the session handling code in a separate file anyway. Try it with the latest version that I've just released.

#2

wayland76 - May 6, 2008 - 01:01
Status:active» postponed (maintainer needs more info)

#3

neilnz - September 9, 2008 - 23:57
Status:postponed (maintainer needs more info)» fixed

Yes the new version works for me

#4

Anonymous (not verified) - September 24, 2008 - 00:01
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.