db_postgres: fix, insert update should always
authorJulien Chavanton <jchavanton@gmail.com>
Mon, 24 Jun 2019 22:34:21 +0000 (15:34 -0700)
committerJulien Chavanton <jchavanton@gmail.com>
Tue, 25 Jun 2019 15:49:45 +0000 (08:49 -0700)
 favor unique constraint over primary key

src/modules/db_postgres/km_dbase.c

index 4ddbe64..0ae7dff 100644 (file)
@@ -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