aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/int.c
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>2000-03-14 23:06:59 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>2000-03-14 23:06:59 +0000
commit64568100787a5d03d036e70b32147385a35245e2 (patch)
tree4b6091aedff9deed40992a05d1cacf9ce1b54c8b /src/backend/utils/adt/int.c
parentce543b2121a772d18e25e1efbad252dcd360df96 (diff)
downloadpostgresql-64568100787a5d03d036e70b32147385a35245e2.tar.gz
postgresql-64568100787a5d03d036e70b32147385a35245e2.zip
Implement column aliases on views "CREATE VIEW name (collist)".
Implement TIME WITH TIME ZONE type (timetz internal type). Remap length() for character strings to CHAR_LENGTH() for SQL92 and to remove the ambiguity with geometric length() functions. Keep length() for character strings for backward compatibility. Shrink stored views by removing internal column name list from visible rte. Implement min(), max() for time and timetz data types. Implement conversion of TIME to INTERVAL. Implement abs(), mod(), fac() for the int8 data type. Rename some math functions to generic names: round(), sqrt(), cbrt(), pow(), etc. Rename NUMERIC power() function to pow(). Fix int2 factorial to calculate result in int4. Enhance the Oracle compatibility function translate() to work with string arguments (from Edwin Ramirez). Modify pg_proc system table to remove OID holes.
Diffstat (limited to 'src/backend/utils/adt/int.c')
-rw-r--r--src/backend/utils/adt/int.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c
index 244bf3aaa4b..7eb7783274c 100644
--- a/src/backend/utils/adt/int.c
+++ b/src/backend/utils/adt/int.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.34 2000/03/07 23:58:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.35 2000/03/14 23:06:36 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -659,8 +659,8 @@ int42mod(int32 arg1, int32 arg2)
return arg1 % arg2;
}
-/*
- * int[24]fac - returns arg1!
+/* int[24]fac()
+ * Factorial
*/
int32
int4fac(int32 arg1)
@@ -678,7 +678,7 @@ int4fac(int32 arg1)
int32
int2fac(int16 arg1)
{
- int16 result;
+ int32 result;
if (arg1 < 1)
result = 0;
@@ -688,6 +688,21 @@ int2fac(int16 arg1)
return result;
}
+/* int[24]abs()
+ * Absolute value
+ */
+int32
+int4abs(int32 arg1)
+{
+ return ((arg1 < 0)? -arg1: arg1);
+}
+
+int16
+int2abs(int16 arg1)
+{
+ return ((arg1 < 0)? -arg1: arg1);
+}
+
int16
int2larger(int16 arg1, int16 arg2)
{