Skip to content

Commit 4574947

Browse files
author
Dipesh Dhameliya
committed
Add support to prepare Bitmapset directly from String
1 parent 0d1812b commit 4574947

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/backend/nodes/read.c

+18
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <ctype.h>
2323

2424
#include "common/string.h"
25+
#include "nodes/bitmapset.h"
2526
#include "nodes/pg_list.h"
2627
#include "nodes/readfuncs.h"
2728
#include "nodes/value.h"
@@ -478,3 +479,20 @@ nodeRead(const char *token, int tok_len)
478479

479480
return (void *) result;
480481
}
482+
483+
/*
484+
* Helper function for Babelfish to build Bitmapset from string.
485+
*/
486+
Bitmapset *
487+
stringToBms(const char *str)
488+
{
489+
Bitmapset *ret;
490+
const char *save_strtok;
491+
492+
save_strtok = pg_strtok_ptr;
493+
pg_strtok_ptr = str; /* point pg_strtok at the string to read */
494+
495+
ret = readBitmapset();
496+
pg_strtok_ptr = save_strtok;
497+
return ret;
498+
}

src/include/nodes/nodes.h

+1
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ extern bool *readBoolCols(int numCols);
654654
extern int *readIntCols(int numCols);
655655
extern Oid *readOidCols(int numCols);
656656
extern int16 *readAttrNumberCols(int numCols);
657+
extern struct Bitmapset *stringToBms(const char *str);
657658

658659
/*
659660
* nodes/copyfuncs.c

0 commit comments

Comments
 (0)