1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Add parse location fields to NullTest and BooleanTest structs.

We did not need a location tag on NullTest or BooleanTest before, because
no error messages referred directly to their locations.  That's planned
to change though, so add these fields in a separate housekeeping commit.

Catversion bump because stored rules may change.
This commit is contained in:
Tom Lane
2015-02-22 14:40:27 -05:00
parent 6a75562ed1
commit c063da1769
14 changed files with 44 additions and 5 deletions

View File

@@ -1693,6 +1693,7 @@ _copyNullTest(const NullTest *from)
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(nulltesttype);
COPY_SCALAR_FIELD(argisrow);
COPY_LOCATION_FIELD(location);
return newnode;
}
@@ -1707,6 +1708,7 @@ _copyBooleanTest(const BooleanTest *from)
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(booltesttype);
COPY_LOCATION_FIELD(location);
return newnode;
}

View File

@@ -622,6 +622,7 @@ _equalNullTest(const NullTest *a, const NullTest *b)
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(nulltesttype);
COMPARE_SCALAR_FIELD(argisrow);
COMPARE_LOCATION_FIELD(location);
return true;
}
@@ -631,6 +632,7 @@ _equalBooleanTest(const BooleanTest *a, const BooleanTest *b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(booltesttype);
COMPARE_LOCATION_FIELD(location);
return true;
}

View File

@@ -1346,12 +1346,22 @@ exprLocation(const Node *expr)
}
break;
case T_NullTest:
/* just use argument's location */
loc = exprLocation((Node *) ((const NullTest *) expr)->arg);
{
const NullTest *nexpr = (const NullTest *) expr;
/* Much as above */
loc = leftmostLoc(nexpr->location,
exprLocation((Node *) nexpr->arg));
}
break;
case T_BooleanTest:
/* just use argument's location */
loc = exprLocation((Node *) ((const BooleanTest *) expr)->arg);
{
const BooleanTest *bexpr = (const BooleanTest *) expr;
/* Much as above */
loc = leftmostLoc(bexpr->location,
exprLocation((Node *) bexpr->arg));
}
break;
case T_CoerceToDomain:
{

View File

@@ -1370,6 +1370,7 @@ _outNullTest(StringInfo str, const NullTest *node)
WRITE_NODE_FIELD(arg);
WRITE_ENUM_FIELD(nulltesttype, NullTestType);
WRITE_BOOL_FIELD(argisrow);
WRITE_LOCATION_FIELD(location);
}
static void
@@ -1379,6 +1380,7 @@ _outBooleanTest(StringInfo str, const BooleanTest *node)
WRITE_NODE_FIELD(arg);
WRITE_ENUM_FIELD(booltesttype, BoolTestType);
WRITE_LOCATION_FIELD(location);
}
static void

View File

@@ -1044,6 +1044,7 @@ _readNullTest(void)
READ_NODE_FIELD(arg);
READ_ENUM_FIELD(nulltesttype, NullTestType);
READ_BOOL_FIELD(argisrow);
READ_LOCATION_FIELD(location);
READ_DONE();
}
@@ -1058,6 +1059,7 @@ _readBooleanTest(void)
READ_NODE_FIELD(arg);
READ_ENUM_FIELD(booltesttype, BoolTestType);
READ_LOCATION_FIELD(location);
READ_DONE();
}