Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: pgrx cannot find function after numeric change interface #410

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/backend/utils/adt/numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,51 @@ numeric_is_integral(Numeric num)
return (arg.ndigits == 0 || arg.ndigits <= arg.weight + 1);
}


/*
* numeric_is_nan() -
*
* Is Numeric value a NaN?
*/
bool
numeric_is_nan(Numeric num)
{
return NUMERIC_IS_NAN(num);
}

/*
* numeric_digits() -
*
* Output function for numeric's digits
*/
NumericDigit *
numeric_digits(Numeric num)
{
return NUMERIC_DIGITS(num);
}

/*
* numeric_len() -
*
* Output size of digits in bytes
*/
int
numeric_len(Numeric num)
{
return NUMERIC_NDIGITS(num) * sizeof(NumericDigit);
}

/*
* numeric_is_inf() -
*
* Is Numeric value an infinity?
*/
bool
numeric_is_inf(Numeric num)
{
return NUMERIC_IS_INF(num);
}

/*
* numeric_maximum_size() -
*
Expand Down
10 changes: 10 additions & 0 deletions src/include/utils/numeric.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ extern float8 numeric_li_fraction(Numeric x, Numeric x0, Numeric x1,
bool *eq_bounds, bool *eq_abscissas);
extern Numeric numeric_li_value(float8 f, Numeric y0, Numeric y1);

/*
* Some of utility functions. which have same definition as the macro,
* but some of extension will these function rather than use the marco
* like `pgrx`.
*/
extern int16 *numeric_digits(Numeric num);
extern int numeric_len(Numeric num);
extern bool numeric_is_nan(Numeric num);
extern bool numeric_is_inf(Numeric num);

/*
* Utility functions in numeric.c
*/
Expand Down
Loading