]> granicus.if.org Git - postgresql/commitdiff
pgrowlocks: fix bogus lock strength output
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 31 Jan 2013 22:11:34 +0000 (19:11 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 31 Jan 2013 22:15:35 +0000 (19:15 -0300)
Per report from digoal@126.com

contrib/pgrowlocks/pgrowlocks.c

index 43ada57352d2f3bb6055e42b200f0c9b228262fa..98aa7c80c085f6d59e446a8713d7af712104194c 100644 (file)
@@ -247,7 +247,12 @@ pgrowlocks(PG_FUNCTION_ARGS)
                                        else if (HEAP_XMAX_IS_KEYSHR_LOCKED(infomask))
                                                snprintf(values[Atnum_modes], NCHARS, "{For Key Share}");
                                        else if (HEAP_XMAX_IS_EXCL_LOCKED(infomask))
-                                               snprintf(values[Atnum_modes], NCHARS, "{For Update}");
+                                       {
+                                               if (tuple->t_data->t_infomask2 & HEAP_KEYS_UPDATED)
+                                                       snprintf(values[Atnum_modes], NCHARS, "{For Update}");
+                                               else
+                                                       snprintf(values[Atnum_modes], NCHARS, "{For No Key Update}");
+                                       }
                                        else
                                                /* neither keyshare nor exclusive bit it set */
                                                snprintf(values[Atnum_modes], NCHARS,
@@ -256,9 +261,9 @@ pgrowlocks(PG_FUNCTION_ARGS)
                                else
                                {
                                        if (tuple->t_data->t_infomask2 & HEAP_KEYS_UPDATED)
-                                               snprintf(values[Atnum_modes], NCHARS, "{Key Update}");
-                                       else
                                                snprintf(values[Atnum_modes], NCHARS, "{Update}");
+                                       else
+                                               snprintf(values[Atnum_modes], NCHARS, "{No Key Update}");
                                }
 
                                values[Atnum_pids] = palloc(NCHARS * sizeof(char));