Skip to content

Commit 7057bf2

Browse files
committed
Fix XID list support some more
Read/out support in 5ca0fe5 was missing/incomplete, per Tom Lane. Again, as far as core is concerned, this is not only dead code but also untested; however, third parties may come to rely on it, so the standard features should work. Discussion: https://postgr.es/m/1548311.1657636605@sss.pgh.pa.us
1 parent 58b4f36 commit 7057bf2

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/backend/nodes/outfuncs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ outNode(StringInfo str, const void *obj)
833833

834834
if (obj == NULL)
835835
appendStringInfoString(str, "<>");
836-
else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList))
836+
else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList) ||
837+
IsA(obj, XidList))
837838
_outList(str, obj);
838839
/* nodeRead does not want to see { } around these! */
839840
else if (IsA(obj, Integer))

src/backend/nodes/read.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ nodeTokenType(const char *token, int length)
304304
* * Value token nodes (integers, floats, booleans, or strings);
305305
* * General nodes (via parseNodeString() from readfuncs.c);
306306
* * Lists of the above;
307-
* * Lists of integers or OIDs.
307+
* * Lists of integers, OIDs, or TransactionIds.
308308
* The return value is declared void *, not Node *, to avoid having to
309309
* cast it explicitly in callers that assign to fields of different types.
310310
*
@@ -346,6 +346,7 @@ nodeRead(const char *token, int tok_len)
346346
/*----------
347347
* Could be an integer list: (i int int ...)
348348
* or an OID list: (o int int ...)
349+
* or an XID list: (x int int ...)
349350
* or a list of nodes/values: (node node ...)
350351
*----------
351352
*/
@@ -392,6 +393,26 @@ nodeRead(const char *token, int tok_len)
392393
l = lappend_oid(l, val);
393394
}
394395
}
396+
else if (tok_len == 1 && token[0] == 'x')
397+
{
398+
/* List of TransactionIds */
399+
for (;;)
400+
{
401+
TransactionId val;
402+
char *endptr;
403+
404+
token = pg_strtok(&tok_len);
405+
if (token == NULL)
406+
elog(ERROR, "unterminated List structure");
407+
if (token[0] == ')')
408+
break;
409+
val = (TransactionId) strtoul(token, &endptr, 10);
410+
if (endptr != token + tok_len)
411+
elog(ERROR, "unrecognized Xid: \"%.*s\"",
412+
tok_len, token);
413+
l = lappend_xid(l, val);
414+
}
415+
}
395416
else
396417
{
397418
/* List of other node types */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy