@ -3972,8 +3972,8 @@ timestamp_trunc(PG_FUNCTION_ARGS)
default :
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp units \" %s \" not supported " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( TIMESTAMPOID ) ) ) ) ;
result = 0 ;
}
@ -3986,8 +3986,8 @@ timestamp_trunc(PG_FUNCTION_ARGS)
{
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " timestamp units \" %s \" not recognized " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not recognized for type %s " ,
lowunits , format_type_be ( TIMESTAMPOID ) ) ) ) ;
result = 0 ;
}
@ -4165,8 +4165,8 @@ timestamptz_trunc_internal(text *units, TimestampTz timestamp, pg_tz *tzp)
default :
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp with time zone units \" %s \" not "
" supported " , lowunits ) ) ) ;
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( TIMESTAMPTZOID ) ) ) ) ;
result = 0 ;
}
@ -4182,8 +4182,8 @@ timestamptz_trunc_internal(text *units, TimestampTz timestamp, pg_tz *tzp)
{
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " timestamp with time zone units \" %s \" not recognized " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not recognized for type %s " ,
lowunits , format_type_be ( TIMESTAMPTZOID ) ) ) ) ;
result = 0 ;
}
@ -4337,17 +4337,11 @@ interval_trunc(PG_FUNCTION_ARGS)
break ;
default :
if ( val = = DTK_WEEK )
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " interval units \" %s \" not supported "
" because months usually have fractional weeks " ,
lowunits ) ) ) ;
else
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " interval units \" %s \" not supported " ,
lowunits ) ) ) ;
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( INTERVALOID ) ) ,
( val = = DTK_WEEK ) ? errdetail ( " Months usually have fractional weeks. " ) : 0 ) ) ;
}
if ( tm2interval ( tm , fsec , result ) ! = 0 )
@ -4362,8 +4356,8 @@ interval_trunc(PG_FUNCTION_ARGS)
{
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " interval units \" %s \" not recognized " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not recognized for type %s " ,
lowunits , format_type_be ( INTERVALOID ) ) ) ) ;
}
PG_RETURN_INTERVAL_P ( result ) ;
@ -4559,18 +4553,11 @@ NonFiniteTimestampTzPart(int type, int unit, char *lowunits,
bool isNegative , bool isTz )
{
if ( ( type ! = UNITS ) & & ( type ! = RESERV ) )
{
if ( isTz )
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " timestamp with time zone units \" %s \" not recognized " ,
lowunits ) ) ) ;
else
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " timestamp units \" %s \" not recognized " ,
lowunits ) ) ) ;
}
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " unit \" %s \" not recognized for type %s " ,
lowunits ,
format_type_be ( isTz ? TIMESTAMPTZOID : TIMESTAMPOID ) ) ) ) ;
switch ( unit )
{
@ -4606,16 +4593,11 @@ NonFiniteTimestampTzPart(int type, int unit, char *lowunits,
return get_float8_infinity ( ) ;
default :
if ( isTz )
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp with time zone units \" %s \" not supported " ,
lowunits ) ) ) ;
else
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp units \" %s \" not supported " ,
lowunits ) ) ) ;
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits ,
format_type_be ( isTz ? TIMESTAMPTZOID : TIMESTAMPOID ) ) ) ) ;
return 0.0 ; /* keep compiler quiet */
}
}
@ -4814,8 +4796,8 @@ timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
default :
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp units \" %s \" not supported " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( TIMESTAMPOID ) ) ) ) ;
intresult = 0 ;
}
}
@ -4861,8 +4843,8 @@ timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
default :
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp units \" %s \" not supported " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( TIMESTAMPOID ) ) ) ) ;
intresult = 0 ;
}
@ -4871,7 +4853,8 @@ timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
{
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " timestamp units \" %s \" not recognized " , lowunits ) ) ) ;
errmsg ( " unit \" %s \" not recognized for type %s " ,
lowunits , format_type_be ( TIMESTAMPOID ) ) ) ) ;
intresult = 0 ;
}
@ -5085,8 +5068,8 @@ timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
default :
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp with time zone units \" %s \" not supported " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( TIMESTAMPTZOID ) ) ) ) ;
intresult = 0 ;
}
@ -5133,8 +5116,8 @@ timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
default :
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " timestamp with time zone units \" %s \" not supported " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( TIMESTAMPTZOID ) ) ) ) ;
intresult = 0 ;
}
}
@ -5142,8 +5125,8 @@ timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
{
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " timestamp with time zone units \" %s \" not recognized " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not recognized for type %s " ,
lowunits , format_type_be ( TIMESTAMPTZOID ) ) ) ) ;
intresult = 0 ;
}
@ -5265,8 +5248,8 @@ interval_part_common(PG_FUNCTION_ARGS, bool retnumeric)
default :
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " interval units \" %s \" not supported " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not supported for type %s " ,
lowunits , format_type_be ( INTERVALOID ) ) ) ) ;
intresult = 0 ;
}
}
@ -5326,8 +5309,8 @@ interval_part_common(PG_FUNCTION_ARGS, bool retnumeric)
{
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_PARAMETER_VALUE ) ,
errmsg ( " interval units \" %s \" not recognized " ,
lowunits ) ) ) ;
errmsg ( " unit \" %s \" not recognized for type %s " ,
lowunits , format_type_be ( INTERVALOID ) ) ) ) ;
intresult = 0 ;
}