[sr-dev] git:master:2bebdb08: db_postgres: fix, insert update should always

Julien Chavanton jchavanton at gmail.com
Tue Jun 25 18:52:24 CEST 2019


Module: kamailio
Branch: master
Commit: 2bebdb083ba8078fa9eec237fe0b0e2134a21b9b
URL: https://github.com/kamailio/kamailio/commit/2bebdb083ba8078fa9eec237fe0b0e2134a21b9b

Author: Julien Chavanton <jchavanton at gmail.com>
Committer: Julien Chavanton <jchavanton at gmail.com>
Date: 2019-06-25T08:49:45-07:00

db_postgres: fix, insert update should always

 favor unique constraint over primary key

---

Modified: src/modules/db_postgres/km_dbase.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2bebdb083ba8078fa9eec237fe0b0e2134a21b9b.diff
Patch: https://github.com/kamailio/kamailio/commit/2bebdb083ba8078fa9eec237fe0b0e2134a21b9b.patch

---

diff --git a/src/modules/db_postgres/km_dbase.c b/src/modules/db_postgres/km_dbase.c
index 4ddbe641b9..0ae7dff54d 100644
--- a/src/modules/db_postgres/km_dbase.c
+++ b/src/modules/db_postgres/km_dbase.c
@@ -788,7 +788,7 @@ static char *db_postgres_constraint_get(const db1_con_t *_h)
 	rows = RES_ROWS(res);
 	for(x = 0; x < RES_ROW_N(res); x++) {
 		val = (ROW_VALUES(&rows[x])[0]).val.string_val;
-		type = (ROW_VALUES(&rows[x])[0]).val.string_val;
+		type = (ROW_VALUES(&rows[x])[1]).val.string_val;
 		LM_DBG("name[%s]type[%s]\n", val, type);
 		if(type[0] == 'u')
 			break; // always favor unique constraint over primary key constraint




More information about the sr-dev mailing list