Index: gw/dlr_pgsql.c
===================================================================
RCS file: /home/cvs/gateway/gw/dlr_pgsql.c,v
retrieving revision 1.9
diff -u -5 -r1.9 dlr_pgsql.c
--- gw/dlr_pgsql.c	10 Jan 2006 12:53:29 -0000	1.9
+++ gw/dlr_pgsql.c	9 Nov 2006 16:06:33 -0000
@@ -218,12 +218,12 @@
 static void dlr_pgsql_remove(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
 {
     Octstr *sql;
 
     debug("dlr.pgsql", 0, "removing DLR from database");
-    sql = octstr_format("DELETE FROM %s WHERE oid = (SELECT oid FROM %s WHERE %s='%s' AND %s='%s' LIMIT 1);",
-                        octstr_get_cstr(fields->table), octstr_get_cstr(fields->table),
+    sql = octstr_format("DELETE FROM %s WHERE %s='%s' AND %s='%s';",
+                        octstr_get_cstr(fields->table),
                         octstr_get_cstr(fields->field_smsc),
                         octstr_get_cstr(smsc), octstr_get_cstr(fields->field_ts), octstr_get_cstr(ts));
 
 
     pgsql_update(sql);
@@ -234,14 +234,13 @@
 static void dlr_pgsql_update(const Octstr *smsc, const Octstr *ts, const Octstr *dst, int status)
 {
     Octstr *sql;
 
     debug("dlr.pgsql", 0, "updating DLR status in database");
-    sql = octstr_format("UPDATE %s SET %s=%d WHERE oid = (SELECT oid FROM %s WHERE %s='%s' AND %s='%s' LIMIT 1);",
+    sql = octstr_format("UPDATE %s SET %s=%d WHERE %s='%s' AND %s='%s';",
                         octstr_get_cstr(fields->table),
                         octstr_get_cstr(fields->field_status), status,
-                        octstr_get_cstr(fields->table),
                         octstr_get_cstr(fields->field_smsc), octstr_get_cstr(smsc),
                         octstr_get_cstr(fields->field_ts), octstr_get_cstr(ts));
     pgsql_update(sql);
     octstr_destroy(sql);
 }
