@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $ PostgreSQL : pgsql / src / backend / executor / execQual . c , v 1.212 2007 / 02 / 03 14 : 06 : 53 petere Exp $
* $ PostgreSQL : pgsql / src / backend / executor / execQual . c , v 1.213 2007 / 02 / 06 17 : 35 : 20 tgl Exp $
*
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
*/
@ -488,8 +488,11 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
* Note : we allow a reference to a dropped attribute . slot_getattr
* Note : we allow a reference to a dropped attribute . slot_getattr
* will force a NULL result in such cases .
* will force a NULL result in such cases .
*
*
* Note : we check typmod , but allow the case that the Var has
* Note : ideally we ' d check typmod as well as typid , but that seems
* unspecified typmod while the column has a specific typmod .
* impractical at the moment : in many cases the tupdesc will have
* been generated by ExecTypeFromTL ( ) , and that can ' t guarantee to
* generate an accurate typmod in all cases , because some expression
* node types don ' t carry typmod .
*/
*/
if ( attnum > 0 )
if ( attnum > 0 )
{
{
@ -505,9 +508,7 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
/* can't check type if dropped, since atttypid is probably 0 */
/* can't check type if dropped, since atttypid is probably 0 */
if ( ! attr - > attisdropped )
if ( ! attr - > attisdropped )
{
{
if ( variable - > vartype ! = attr - > atttypid | |
if ( variable - > vartype ! = attr - > atttypid )
( variable - > vartypmod ! = attr - > atttypmod & &
variable - > vartypmod ! = - 1 ) )
ereport ( ERROR ,
ereport ( ERROR ,
( errmsg ( " attribute %d has wrong type " , attnum ) ,
( errmsg ( " attribute %d has wrong type " , attnum ) ,
errdetail ( " Table has type %s, but query expects %s. " ,
errdetail ( " Table has type %s, but query expects %s. " ,
@ -3362,9 +3363,8 @@ ExecEvalFieldSelect(FieldSelectState *fstate,
}
}
/* Check for type mismatch --- possible after ALTER COLUMN TYPE? */
/* Check for type mismatch --- possible after ALTER COLUMN TYPE? */
if ( fselect - > resulttype ! = attr - > atttypid | |
/* As in ExecEvalVar, we should but can't check typmod */
( fselect - > resulttypmod ! = attr - > atttypmod & &
if ( fselect - > resulttype ! = attr - > atttypid )
fselect - > resulttypmod ! = - 1 ) )
ereport ( ERROR ,
ereport ( ERROR ,
( errmsg ( " attribute %d has wrong type " , fieldnum ) ,
( errmsg ( " attribute %d has wrong type " , fieldnum ) ,
errdetail ( " Table has type %s, but query expects %s. " ,
errdetail ( " Table has type %s, but query expects %s. " ,