Commit 0babf316 authored by Peter Eisentraut's avatar Peter Eisentraut

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.
parent 0c0dde61
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.130 2000/10/31 10:22:10 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.131 2000/10/31 13:59:52 petere Exp $
* *
* NOTES * NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which * Every (plan) node in POSTGRES has an associated "out" routine which
...@@ -1353,7 +1353,8 @@ _outValue(StringInfo str, Value *value) ...@@ -1353,7 +1353,8 @@ _outValue(StringInfo str, Value *value)
appendStringInfo(str, "\" "); appendStringInfo(str, "\" ");
break; break;
case T_BitString: case T_BitString:
appendStringInfo(str, " B%s ", value->val.str); /* internal representation already has leading 'b' */
appendStringInfo(str, " %s ", value->val.str);
break; break;
default: default:
elog(NOTICE, "_outValue: don't know how to print type %d ", elog(NOTICE, "_outValue: don't know how to print type %d ",
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.24 2000/10/31 10:22:10 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.25 2000/10/31 13:59:52 petere Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -236,7 +236,7 @@ nodeTokenType(char *token, int length) ...@@ -236,7 +236,7 @@ nodeTokenType(char *token, int length)
retval = AT_SYMBOL; retval = AT_SYMBOL;
else if (*token == '\"' && length > 1 && token[length - 1] == '\"') else if (*token == '\"' && length > 1 && token[length - 1] == '\"')
retval = T_String; retval = T_String;
else if (*token == 'B') else if (*token == 'b')
retval = T_BitString; retval = T_BitString;
else else
retval = ATOM_TOKEN; retval = ATOM_TOKEN;
...@@ -351,7 +351,7 @@ nodeRead(bool read_car_only) ...@@ -351,7 +351,7 @@ nodeRead(bool read_car_only)
case T_BitString: case T_BitString:
{ {
char * val = palloc(tok_len); char * val = palloc(tok_len);
/* skip leading 'B'*/ /* skip leading 'b'*/
strncpy(val, token + 1, tok_len - 1); strncpy(val, token + 1, tok_len - 1);
val[tok_len - 1] = '\0'; val[tok_len - 1] = '\0';
this_value = (Node *) makeBitString(val); this_value = (Node *) makeBitString(val);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.80 2000/10/31 10:22:11 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.81 2000/10/31 13:59:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -282,10 +282,11 @@ other . ...@@ -282,10 +282,11 @@ other .
{xbitstart} { {xbitstart} {
BEGIN(xbit); BEGIN(xbit);
startlit(); startlit();
addlit("b", 1);
} }
<xbit>{xbitstop} { <xbit>{xbitstop} {
BEGIN(INITIAL); BEGIN(INITIAL);
if (literalbuf[strspn(literalbuf, "01")] != '\0') if (literalbuf[strspn(literalbuf + 1, "01") + 1] != '\0')
elog(ERROR, "invalid bit string input: '%s'", elog(ERROR, "invalid bit string input: '%s'",
literalbuf); literalbuf);
yylval.str = literalbuf; yylval.str = literalbuf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment