summaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-11-13 10:22:45 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-11-13 10:22:45 -0500
commit5e1f3b9ebf6e51f2c60abe9aba969c28a3b0f6c6 (patch)
treed12f6c444f7ca89fe26e69695884412d79703b01 /src/backend/nodes/outfuncs.c
parent9c7eb9d85a5687d4f9624c40ee3a508d8c7de35a (diff)
downloadpostgresql-5e1f3b9ebf6e51f2c60abe9aba969c28a3b0f6c6.tar.gz
Make Bitmapsets be valid Nodes.
Add a NodeTag field to struct Bitmapset. This is free because of alignment considerations on 64-bit hardware. While it adds some space on 32-bit machines, we aren't optimizing for that case anymore. The advantage is that data structures such as Lists of Bitmapsets are now first-class objects to the Node infrastructure, and don't require special-case code to handle. This patch includes removal of one such special case, in indxpath.c: bms_equal_any() can now be replaced by list_member(). There may be more existing code that could be simplified, but I didn't look very hard. We also get to drop the read_write_ignore annotations on a couple of RelOptInfo fields. The outfuncs/readfuncs support is arranged so that nothing changes in the string representation of a Bitmapset field; therefore, this doesn't need a catversion bump. Amit Langote and Tom Lane Discussion: https://postgr.es/m/109089.1668197158@sss.pgh.pa.us
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 64c65f060b..f05e72f0dc 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -314,6 +314,9 @@ _outList(StringInfo str, const List *node)
* converts a bitmap set of integers
*
* Note: the output format is "(b int int ...)", similar to an integer List.
+ *
+ * We export this function for use by extensions that define extensible nodes.
+ * That's somewhat historical, though, because calling outNode() will work.
*/
void
outBitmapset(StringInfo str, const Bitmapset *bms)
@@ -844,6 +847,8 @@ outNode(StringInfo str, const void *obj)
_outString(str, (String *) obj);
else if (IsA(obj, BitString))
_outBitString(str, (BitString *) obj);
+ else if (IsA(obj, Bitmapset))
+ outBitmapset(str, (Bitmapset *) obj);
else
{
appendStringInfoChar(str, '{');