aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/date.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2012-02-08 09:33:02 -0500
committerRobert Haas <rhaas@postgresql.org>2012-02-08 09:33:37 -0500
commitc13897983a0006e658fb7c6410d72ca59fb87136 (patch)
tree4e228cac44cab1c1e80173511578ff248346a204 /src/backend/utils/adt/date.c
parent1a01560cbb78ff363fc7d70298328aa23f05bfb5 (diff)
downloadpostgresql-c13897983a0006e658fb7c6410d72ca59fb87136.tar.gz
postgresql-c13897983a0006e658fb7c6410d72ca59fb87136.zip
Add transform functions for various temporal typmod coercisions.
This enables ALTER TABLE to skip table and index rebuilds in some cases. Noah Misch, with trivial changes by me.
Diffstat (limited to 'src/backend/utils/adt/date.c')
-rw-r--r--src/backend/utils/adt/date.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index bf3b6ea1deb..85e8fd00ff2 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -1210,6 +1210,17 @@ timetypmodout(PG_FUNCTION_ARGS)
}
+/* time_transform()
+ * Flatten calls to time_scale() and timetz_scale() that solely represent
+ * increases in allowed precision.
+ */
+Datum
+time_transform(PG_FUNCTION_ARGS)
+{
+ PG_RETURN_POINTER(TemporalTransform(MAX_TIME_PRECISION,
+ (Node *) PG_GETARG_POINTER(0)));
+}
+
/* time_scale()
* Adjust time type for specified scale factor.
* Used by PostgreSQL type system to stuff columns.