aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2023-01-10 08:53:12 +0530
committerAmit Kapila <akapila@postgresql.org>2023-01-10 08:53:47 +0530
commitf745739697e49a38a31a755d7d36d6c97008dd9f (patch)
treed88fe10efecbd3468fd898fc8d617cb7154162a6
parentbd8d453e9b5f8b632a400a9e796fc041aed76d82 (diff)
downloadpostgresql-f745739697e49a38a31a755d7d36d6c97008dd9f.tar.gz
postgresql-f745739697e49a38a31a755d7d36d6c97008dd9f.zip
Fix the display of lock information for specktoken.
A transaction id is now displayed in the transactionid field and speculative insertion token is displayed in the objid field. Author: Sawada Masahiko Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CAD21AoCEKxZztULP1CDm45aSNNR1QO-Bh1q6LMTspQ78PBuJrw@mail.gmail.com
-rw-r--r--doc/src/sgml/system-views.sgml6
-rw-r--r--src/backend/utils/adt/lockfuncs.c12
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 1d1b7de8f1e..5b1c73269b9 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -1580,6 +1580,12 @@
</para>
<para>
+ A specualtive insertion lock consists of a transaction ID and a speculative
+ insertion token. The speculative insertion token is displayed in the
+ <structfield>objid</structfield> column.
+ </para>
+
+ <para>
Advisory locks can be acquired on keys consisting of either a single
<type>bigint</type> value or two integer values.
A <type>bigint</type> key is displayed with its
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index c8aac0694fe..f9b9590997b 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -313,6 +313,18 @@ pg_lock_status(PG_FUNCTION_ARGS)
nulls[8] = true;
nulls[9] = true;
break;
+ case LOCKTAG_SPECULATIVE_TOKEN:
+ values[6] =
+ TransactionIdGetDatum(instance->locktag.locktag_field1);
+ values[8] = ObjectIdGetDatum(instance->locktag.locktag_field2);
+ nulls[1] = true;
+ nulls[2] = true;
+ nulls[3] = true;
+ nulls[4] = true;
+ nulls[5] = true;
+ nulls[7] = true;
+ nulls[9] = true;
+ break;
case LOCKTAG_APPLY_TRANSACTION:
values[1] = ObjectIdGetDatum(instance->locktag.locktag_field1);
values[8] = ObjectIdGetDatum(instance->locktag.locktag_field2);