1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Fix the raw-parsetree representation of star (as in SELECT * FROM or

SELECT foo.*) so that it cannot be confused with a quoted identifier "*".
Instead create a separate node type A_Star to represent this notation.
Per pgsql-hackers discussion of 2007-Sep-27.
This commit is contained in:
Tom Lane
2008-08-30 01:39:14 +00:00
parent 6253f9de67
commit 449a00fbbd
13 changed files with 223 additions and 106 deletions

View File

@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.402 2008/08/28 23:09:45 tgl Exp $
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.403 2008/08/30 01:39:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1697,6 +1697,14 @@ _copyFuncCall(FuncCall *from)
return newnode;
}
static A_Star *
_copyAStar(A_Star *from)
{
A_Star *newnode = makeNode(A_Star);
return newnode;
}
static A_Indices *
_copyAIndices(A_Indices *from)
{
@ -3589,6 +3597,9 @@ copyObject(void *from)
case T_FuncCall:
retval = _copyFuncCall(from);
break;
case T_A_Star:
retval = _copyAStar(from);
break;
case T_A_Indices:
retval = _copyAIndices(from);
break;

View File

@ -22,7 +22,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.329 2008/08/28 23:09:46 tgl Exp $
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.330 2008/08/30 01:39:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1765,6 +1765,12 @@ _equalFuncCall(FuncCall *a, FuncCall *b)
return true;
}
static bool
_equalAStar(A_Star *a, A_Star *b)
{
return true;
}
static bool
_equalAIndices(A_Indices *a, A_Indices *b)
{
@ -2531,6 +2537,9 @@ equal(void *a, void *b)
case T_FuncCall:
retval = _equalFuncCall(a, b);
break;
case T_A_Star:
retval = _equalAStar(a, b);
break;
case T_A_Indices:
retval = _equalAIndices(a, b);
break;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.336 2008/08/28 23:09:46 tgl Exp $
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.337 2008/08/30 01:39:14 tgl Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@ -1989,6 +1989,12 @@ _outAConst(StringInfo str, A_Const *node)
WRITE_LOCATION_FIELD(location);
}
static void
_outA_Star(StringInfo str, A_Star *node)
{
WRITE_NODE_TYPE("A_STAR");
}
static void
_outA_Indices(StringInfo str, A_Indices *node)
{
@ -2467,6 +2473,9 @@ _outNode(StringInfo str, void *obj)
case T_A_Const:
_outAConst(str, obj);
break;
case T_A_Star:
_outA_Star(str, obj);
break;
case T_A_Indices:
_outA_Indices(str, obj);
break;