@ -4676,7 +4676,7 @@ timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
switch ( val )
{
case DTK_MICROSEC :
intresult = tm - > tm_sec * 1000000.0 + fsec ;
intresult = tm - > tm_sec * INT64CONST ( 1000000 ) + fsec ;
break ;
case DTK_MILLISEC :
@ -4685,7 +4685,7 @@ timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
* tm - > tm_sec * 1000 + fsec / 1000
* = ( tm - > tm_sec * 1 ' 000 ' 000 + fsec ) / 1000
*/
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * 1000000LL + fsec , 3 ) ) ;
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * INT64CONST ( 1000000 ) + fsec , 3 ) ) ;
else
PG_RETURN_FLOAT8 ( tm - > tm_sec * 1000.0 + fsec / 1000.0 ) ;
break ;
@ -4696,7 +4696,7 @@ timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
* tm - > tm_sec + fsec / 1 ' 000 ' 000
* = ( tm - > tm_sec * 1 ' 000 ' 000 + fsec ) / 1 ' 000 ' 000
*/
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * 1000000LL + fsec , 6 ) ) ;
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * INT64CONST ( 1000000 ) + fsec , 6 ) ) ;
else
PG_RETURN_FLOAT8 ( tm - > tm_sec + fsec / 1000000.0 ) ;
break ;
@ -4772,8 +4772,8 @@ timestamp_part_common(PG_FUNCTION_ARGS, bool retnumeric)
case DTK_JULIAN :
if ( retnumeric )
PG_RETURN_NUMERIC ( numeric_add_opt_error ( int64_to_numeric ( date2j ( tm - > tm_year , tm - > tm_mon , tm - > tm_mday ) ) ,
numeric_div_opt_error ( int64_to_numeric ( ( ( ( ( tm - > tm_hour * MINS_PER_HOUR ) + tm - > tm_min ) * SECS_PER_MINUTE ) + tm - > tm_sec ) * 1000000LL + fsec ) ,
int64_to_numeric ( SECS_PER_DAY * 1000000LL ) ,
numeric_div_opt_error ( int64_to_numeric ( ( ( ( ( tm - > tm_hour * MINS_PER_HOUR ) + tm - > tm_min ) * SECS_PER_MINUTE ) + tm - > tm_sec ) * INT64CONST ( 1000000 ) + fsec ) ,
int64_to_numeric ( SECS_PER_DAY * INT64CONST ( 1000000 ) ) ,
NULL ) ,
NULL ) ) ;
else
@ -4962,7 +4962,7 @@ timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
break ;
case DTK_MICROSEC :
intresult = tm - > tm_sec * 1000000 + fsec ;
intresult = tm - > tm_sec * INT64CONST ( 1000000 ) + fsec ;
break ;
case DTK_MILLISEC :
@ -4971,7 +4971,7 @@ timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
* tm - > tm_sec * 1000 + fsec / 1000
* = ( tm - > tm_sec * 1 ' 000 ' 000 + fsec ) / 1000
*/
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * 1000000LL + fsec , 3 ) ) ;
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * INT64CONST ( 1000000 ) + fsec , 3 ) ) ;
else
PG_RETURN_FLOAT8 ( tm - > tm_sec * 1000.0 + fsec / 1000.0 ) ;
break ;
@ -4982,7 +4982,7 @@ timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
* tm - > tm_sec + fsec / 1 ' 000 ' 000
* = ( tm - > tm_sec * 1 ' 000 ' 000 + fsec ) / 1 ' 000 ' 000
*/
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * 1000000LL + fsec , 6 ) ) ;
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * INT64CONST ( 1000000 ) + fsec , 6 ) ) ;
else
PG_RETURN_FLOAT8 ( tm - > tm_sec + fsec / 1000000.0 ) ;
break ;
@ -5046,8 +5046,8 @@ timestamptz_part_common(PG_FUNCTION_ARGS, bool retnumeric)
case DTK_JULIAN :
if ( retnumeric )
PG_RETURN_NUMERIC ( numeric_add_opt_error ( int64_to_numeric ( date2j ( tm - > tm_year , tm - > tm_mon , tm - > tm_mday ) ) ,
numeric_div_opt_error ( int64_to_numeric ( ( ( ( ( tm - > tm_hour * MINS_PER_HOUR ) + tm - > tm_min ) * SECS_PER_MINUTE ) + tm - > tm_sec ) * 1000000LL + fsec ) ,
int64_to_numeric ( SECS_PER_DAY * 1000000LL ) ,
numeric_div_opt_error ( int64_to_numeric ( ( ( ( ( tm - > tm_hour * MINS_PER_HOUR ) + tm - > tm_min ) * SECS_PER_MINUTE ) + tm - > tm_sec ) * INT64CONST ( 1000000 ) + fsec ) ,
int64_to_numeric ( SECS_PER_DAY * INT64CONST ( 1000000 ) ) ,
NULL ) ,
NULL ) ) ;
else
@ -5191,7 +5191,7 @@ interval_part_common(PG_FUNCTION_ARGS, bool retnumeric)
switch ( val )
{
case DTK_MICROSEC :
intresult = tm - > tm_sec * 1000000 + fsec ;
intresult = tm - > tm_sec * INT64CONST ( 1000000 ) + fsec ;
break ;
case DTK_MILLISEC :
@ -5200,7 +5200,7 @@ interval_part_common(PG_FUNCTION_ARGS, bool retnumeric)
* tm - > tm_sec * 1000 + fsec / 1000
* = ( tm - > tm_sec * 1 ' 000 ' 000 + fsec ) / 1000
*/
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * 1000000LL + fsec , 3 ) ) ;
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * INT64CONST ( 1000000 ) + fsec , 3 ) ) ;
else
PG_RETURN_FLOAT8 ( tm - > tm_sec * 1000.0 + fsec / 1000.0 ) ;
break ;
@ -5211,7 +5211,7 @@ interval_part_common(PG_FUNCTION_ARGS, bool retnumeric)
* tm - > tm_sec + fsec / 1 ' 000 ' 000
* = ( tm - > tm_sec * 1 ' 000 ' 000 + fsec ) / 1 ' 000 ' 000
*/
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * 1000000LL + fsec , 6 ) ) ;
PG_RETURN_NUMERIC ( int64_div_fast_to_numeric ( tm - > tm_sec * INT64CONST ( 1000000 ) + fsec , 6 ) ) ;
else
PG_RETURN_FLOAT8 ( tm - > tm_sec + fsec / 1000000.0 ) ;
break ;