Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0babf31

Browse files
committed
Change internal string representation of BitString node to include a
leading 'b', as it appears to be more convenient this way for the input and node functions.
1 parent 0c0dde6 commit 0babf31

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/backend/nodes/outfuncs.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.130 2000/10/31 10:22:10 petere Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.131 2000/10/31 13:59:52 petere Exp $
1010
*
1111
* NOTES
1212
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -1353,7 +1353,8 @@ _outValue(StringInfo str, Value *value)
13531353
appendStringInfo(str, "\" ");
13541354
break;
13551355
case T_BitString:
1356-
appendStringInfo(str, " B%s ", value->val.str);
1356+
/* internal representation already has leading 'b' */
1357+
appendStringInfo(str, " %s ", value->val.str);
13571358
break;
13581359
default:
13591360
elog(NOTICE, "_outValue: don't know how to print type %d ",

src/backend/nodes/read.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.24 2000/10/31 10:22:10 petere Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.25 2000/10/31 13:59:52 petere Exp $
1313
*
1414
* HISTORY
1515
* AUTHOR DATE MAJOR EVENT
@@ -236,7 +236,7 @@ nodeTokenType(char *token, int length)
236236
retval = AT_SYMBOL;
237237
else if (*token == '\"' && length > 1 && token[length - 1] == '\"')
238238
retval = T_String;
239-
else if (*token == 'B')
239+
else if (*token == 'b')
240240
retval = T_BitString;
241241
else
242242
retval = ATOM_TOKEN;
@@ -351,7 +351,7 @@ nodeRead(bool read_car_only)
351351
case T_BitString:
352352
{
353353
char * val = palloc(tok_len);
354-
/* skip leading 'B'*/
354+
/* skip leading 'b'*/
355355
strncpy(val, token + 1, tok_len - 1);
356356
val[tok_len - 1] = '\0';
357357
this_value = (Node *) makeBitString(val);

src/backend/parser/scan.l

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.80 2000/10/31 10:22:11 petere Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.81 2000/10/31 13:59:53 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -282,10 +282,11 @@ other .
282282
{xbitstart} {
283283
BEGIN(xbit);
284284
startlit();
285+
addlit("b", 1);
285286
}
286287
<xbit>{xbitstop} {
287288
BEGIN(INITIAL);
288-
if (literalbuf[strspn(literalbuf, "01")] != '\0')
289+
if (literalbuf[strspn(literalbuf + 1, "01") + 1] != '\0')
289290
elog(ERROR, "invalid bit string input: '%s'",
290291
literalbuf);
291292
yylval.str = literalbuf;

0 commit comments

Comments
 (0)