1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Clean up some problems with redundant cross-type arithmetic operators. Add

int2-and-int8 implementations of the basic arithmetic operators +, -, *, /.
This doesn't really add any new functionality, but it avoids "operator is not
unique" failures that formerly occurred in these cases because the parser
couldn't decide whether to promote the int2 to int4 or int8.  We could
alternatively have removed the existing cross-type operators, but
experimentation shows that the cost of an additional type coercion expression
node is noticeable compared to such cheap operators; so let's not give up any
performance here.  On the other hand, I removed the int2-and-int4 modulo (%)
operators since they didn't seem as important from a performance standpoint.
Per a complaint last January from ykhuang.
This commit is contained in:
Tom Lane
2008-06-17 19:10:56 +00:00
parent 4274726d42
commit b163baa89c
7 changed files with 223 additions and 50 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/int8.h,v 1.48 2008/01/01 19:45:59 momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/int8.h,v 1.49 2008/06/17 19:10:56 tgl Exp $
*
* NOTES
* These data types are supported on all 64-bit architectures, and may
@@ -96,6 +96,16 @@ extern Datum int48mi(PG_FUNCTION_ARGS);
extern Datum int48mul(PG_FUNCTION_ARGS);
extern Datum int48div(PG_FUNCTION_ARGS);
extern Datum int82pl(PG_FUNCTION_ARGS);
extern Datum int82mi(PG_FUNCTION_ARGS);
extern Datum int82mul(PG_FUNCTION_ARGS);
extern Datum int82div(PG_FUNCTION_ARGS);
extern Datum int28pl(PG_FUNCTION_ARGS);
extern Datum int28mi(PG_FUNCTION_ARGS);
extern Datum int28mul(PG_FUNCTION_ARGS);
extern Datum int28div(PG_FUNCTION_ARGS);
extern Datum int48(PG_FUNCTION_ARGS);
extern Datum int84(PG_FUNCTION_ARGS);