mirror of
https://github.com/postgres/postgres.git
synced 2025-07-23 03:21:12 +03:00
Change the parser to convert SQL "position" and "substring" syntax to
position() and substring() functions, so that it works transparently for bit types as well. Alias the text functions appropriately. Add position() for bit types. Add new constant node T_BitString that represents literals of the form B'1001 and pass those to zpbit type.
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.23 2000/06/14 18:17:32 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.24 2000/10/31 10:22:10 petere Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -17,11 +17,11 @@
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "nodes/pg_list.h"
|
||||
#include "nodes/readfuncs.h"
|
||||
|
||||
@ -184,7 +184,7 @@ debackslash(char *token, int length)
|
||||
* nodeTokenType -
|
||||
* returns the type of the node token contained in token.
|
||||
* It returns one of the following valid NodeTags:
|
||||
* T_Integer, T_Float, T_String
|
||||
* T_Integer, T_Float, T_String, T_BitString
|
||||
* and some of its own:
|
||||
* RIGHT_PAREN, LEFT_PAREN, PLAN_SYM, AT_SYMBOL, ATOM_TOKEN
|
||||
*
|
||||
@ -236,6 +236,8 @@ nodeTokenType(char *token, int length)
|
||||
retval = AT_SYMBOL;
|
||||
else if (*token == '\"' && length > 1 && token[length - 1] == '\"')
|
||||
retval = T_String;
|
||||
else if (*token == 'B')
|
||||
retval = T_BitString;
|
||||
else
|
||||
retval = ATOM_TOKEN;
|
||||
return retval;
|
||||
@ -346,6 +348,15 @@ nodeRead(bool read_car_only)
|
||||
this_value = (Node *) makeString(debackslash(token + 1, tok_len - 2));
|
||||
make_dotted_pair_cell = true;
|
||||
break;
|
||||
case T_BitString:
|
||||
{
|
||||
char * val = palloc(tok_len);
|
||||
/* skip leading 'B'*/
|
||||
strncpy(val, token + 1, tok_len - 1);
|
||||
val[tok_len - 1] = '\0';
|
||||
this_value = (Node *) makeBitString(val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
elog(ERROR, "nodeRead: Bad type %d", type);
|
||||
this_value = NULL; /* keep compiler happy */
|
||||
|
Reference in New Issue
Block a user