pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] Fix XID list support some more
1+ messages / 1 participants
[nested] [flat]

* [PATCH] Fix XID list support some more
@ 2022-07-12 14:48  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 1+ messages in thread

From: Alvaro Herrera @ 2022-07-12 14:48 UTC (permalink / raw)

Read/out support in 5ca0fe5c8ad7 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.

Discussion: https://postgr.es/m/1548311.1657636605@sss.pgh.pa.us
---
 src/backend/nodes/outfuncs.c |  3 ++-
 src/backend/nodes/read.c     | 23 ++++++++++++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

inline patch 1: src/backend/nodes/outfuncs.c, src/backend/nodes/read.c (+24/-2 lines) download inline-1.patchdiff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 4d776e7b51..9e43fec86d 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -833,7 +833,8 @@ outNode(StringInfo str, const void *obj) if (obj == NULL) appendStringInfoString(str, "<>"); - else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList)) + else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList) || + IsA(obj, XidList)) _outList(str, obj); /* nodeRead does not want to see { } around these! */ else if (IsA(obj, Integer)) diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c index 1e61fde636..4a54996b63 100644 --- a/src/backend/nodes/read.c +++ b/src/backend/nodes/read.c @@ -304,7 +304,7 @@ nodeTokenType(const char *token, int length) * * Value token nodes (integers, floats, booleans, or strings); * * General nodes (via parseNodeString() from readfuncs.c); * * Lists of the above; - * * Lists of integers or OIDs. + * * Lists of integers, OIDs, or TransactionIds. * The return value is declared void *, not Node *, to avoid having to * cast it explicitly in callers that assign to fields of different types. * @@ -346,6 +346,7 @@ nodeRead(const char *token, int tok_len) /*---------- * Could be an integer list: (i int int ...) * or an OID list: (o int int ...) + * or an XID list: (x int int ...) * or a list of nodes/values: (node node ...) *---------- */ @@ -392,6 +393,26 @@ nodeRead(const char *token, int tok_len) l = lappend_oid(l, val); } } + else if (tok_len == 1 && token[0] == 'x') + { + /* List of TransactionIds */ + for (;;) + { + TransactionId val; + char *endptr; + + token = pg_strtok(&tok_len); + if (token == NULL) + elog(ERROR, "unterminated List structure"); + if (token[0] == ')') + break; + val = (TransactionId) strtoul(token, &endptr, 10); + if (endptr != token + tok_len) + elog(ERROR, "unrecognized Xid: \"%.*s\"", + tok_len, token); + l = lappend_xid(l, val); + } + } else { /* List of other node types */ -- 2.30.2
--oc7di7olfo6fqszi-- ^ permalink raw reply [nested|flat] 1+ messages in thread


only message in thread

Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 14:48 [PATCH] Fix XID list support some more Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox