summaryrefslogtreecommitdiffstats
path: root/src/backend/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes')
-rw-r--r--src/backend/nodes/outfuncs.c9
-rw-r--r--src/backend/nodes/read.c11
2 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 9552865..e56392e 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -680,8 +680,13 @@ _outString(StringInfo str, const String *node)
static void
_outBitString(StringInfo str, const BitString *node)
{
- /* internal representation already has leading 'b' */
- appendStringInfoString(str, node->bsval);
+ /*
+ * The lexer will always produce a string starting with 'b' or 'x'. There
+ * might be characters following that that need escaping, but outToken
+ * won't escape the 'b' or 'x'. This is relied on by nodeTokenType.
+ */
+ Assert(node->bsval[0] == 'b' || node->bsval[0] == 'x');
+ outToken(str, node->bsval);
}
static void
diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c
index 813eda3..5d76f56 100644
--- a/src/backend/nodes/read.c
+++ b/src/backend/nodes/read.c
@@ -498,14 +498,9 @@ nodeRead(const char *token, int tok_len)
result = (Node *) makeString(debackslash(token + 1, tok_len - 2));
break;
case T_BitString:
- {
- char *val = palloc(tok_len + 1);
-
- memcpy(val, token, tok_len);
- val[tok_len] = '\0';
- result = (Node *) makeBitString(val);
- break;
- }
+ /* need to remove backslashes, but there are no quotes */
+ result = (Node *) makeBitString(debackslash(token, tok_len));
+ break;
default:
elog(ERROR, "unrecognized node type: %d", (int) type);
result = NULL; /* keep compiler happy */