Skip to content

Commit f745739

Browse files
author
Amit Kapila
committed
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
1 parent bd8d453 commit f745739

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

doc/src/sgml/system-views.sgml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,12 @@
15791579
permanent transaction ID of the current holder of that row lock.
15801580
</para>
15811581

1582+
<para>
1583+
A specualtive insertion lock consists of a transaction ID and a speculative
1584+
insertion token. The speculative insertion token is displayed in the
1585+
<structfield>objid</structfield> column.
1586+
</para>
1587+
15821588
<para>
15831589
Advisory locks can be acquired on keys consisting of either a single
15841590
<type>bigint</type> value or two integer values.

src/backend/utils/adt/lockfuncs.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,18 @@ pg_lock_status(PG_FUNCTION_ARGS)
313313
nulls[8] = true;
314314
nulls[9] = true;
315315
break;
316+
case LOCKTAG_SPECULATIVE_TOKEN:
317+
values[6] =
318+
TransactionIdGetDatum(instance->locktag.locktag_field1);
319+
values[8] = ObjectIdGetDatum(instance->locktag.locktag_field2);
320+
nulls[1] = true;
321+
nulls[2] = true;
322+
nulls[3] = true;
323+
nulls[4] = true;
324+
nulls[5] = true;
325+
nulls[7] = true;
326+
nulls[9] = true;
327+
break;
316328
case LOCKTAG_APPLY_TRANSACTION:
317329
values[1] = ObjectIdGetDatum(instance->locktag.locktag_field1);
318330
values[8] = ObjectIdGetDatum(instance->locktag.locktag_field2);

0 commit comments

Comments
 (0)