aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2009-06-10 07:03:34 +0000
committerPeter Eisentraut <peter_e@gmx.net>2009-06-10 07:03:34 +0000
commit208d3a7555541383aadf682e47c14fed21468374 (patch)
tree01ac99ca659c11bd34b281fd285d45b8749965f3 /src
parent5cca35a68b63c00d6a7b5d68868f809163929087 (diff)
downloadpostgresql-208d3a7555541383aadf682e47c14fed21468374.tar.gz
postgresql-208d3a7555541383aadf682e47c14fed21468374.zip
Correct/improve the datetime_precision field in the information schema.
In particular, always show 0 for the date type instead of null, and show 6 (the default) for time, timestamp, and interval without a declared precision. This is now in fuller conformance with the SQL standard. Also clarify the documentation about this. discovered and analyzed by Konstantin Izmailov and Tom Lane
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/information_schema.sql10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql
index 80132e27ea4..b295abbeab5 100644
--- a/src/backend/catalog/information_schema.sql
+++ b/src/backend/catalog/information_schema.sql
@@ -4,7 +4,7 @@
*
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.53 2009/02/24 10:06:32 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/information_schema.sql,v 1.54 2009/06/10 07:03:34 petere Exp $
*/
/*
@@ -160,12 +160,12 @@ CREATE FUNCTION _pg_datetime_precision(typid oid, typmod int4) RETURNS integer
RETURNS NULL ON NULL INPUT
AS
$$SELECT
- CASE WHEN $2 = -1 /* default typmod */
- THEN null
+ CASE WHEN $1 IN (1082) /* date */
+ THEN 0
WHEN $1 IN (1083, 1114, 1184, 1266) /* time, timestamp, same + tz */
- THEN $2
+ THEN CASE WHEN $2 < 0 THEN 6 ELSE $2 END
WHEN $1 IN (1186) /* interval */
- THEN $2 & 65535
+ THEN CASE WHEN $2 < 0 THEN 6 ELSE $2 & 65535 END
ELSE null
END$$;