aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/numeric.c
diff options
context:
space:
mode:
authorDean Rasheed <dean.a.rasheed@gmail.com>2023-02-02 09:39:08 +0000
committerDean Rasheed <dean.a.rasheed@gmail.com>2023-02-02 09:39:08 +0000
commit9a84f2947bf9345ad6b93ba37da63633649eaea8 (patch)
tree26b04d3443b68d3607e4fc0820f42ac170bc81b6 /src/backend/utils/adt/numeric.c
parent117d2604c2a59eb853e894410b94b4c453f8bd43 (diff)
downloadpostgresql-9a84f2947bf9345ad6b93ba37da63633649eaea8.tar.gz
postgresql-9a84f2947bf9345ad6b93ba37da63633649eaea8.zip
Ensure that numeric.c compiles with other NBASE values.
As noted in the comments, support for different NBASE values is really only of historical interest, but as long as we're keeping it, we might as well make sure that it compiles. Joel Jacobson Discussion: https://postgr.es/m/06712c29-98e9-43b3-98da-f234d81c6e49%40app.fastmail.com
Diffstat (limited to 'src/backend/utils/adt/numeric.c')
-rw-r--r--src/backend/utils/adt/numeric.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 898c52099bd..834339dcff2 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -4245,7 +4245,15 @@ int64_div_fast_to_numeric(int64 val1, int log10val2)
*/
if (m > 0)
{
+#if DEC_DIGITS == 4
static int pow10[] = {1, 10, 100, 1000};
+#elif DEC_DIGITS == 2
+ static int pow10[] = {1, 10};
+#elif DEC_DIGITS == 1
+ static int pow10[] = {1};
+#else
+#error unsupported NBASE
+#endif
StaticAssertDecl(lengthof(pow10) == DEC_DIGITS, "mismatch with DEC_DIGITS");