Look at a sample output of using the date function
postgres# select id, date(dt), dt from a;
id | date | dt
----+------------+----------------------------
1 | 2014-12-15 | 2014-12-15 16:32:13.942183
2 | 2014-12-15 | 2014-12-15 16:34:05.480178
(2 rows)
Time: 2.190 ms
The type of data stored is different.
Somebody else might use the function a different way:
postgres# SELECT *
FROM a
WHERE dt >= '2014-12-15 16:33' AND dt < '2014-12-16 ';
id | dt
----+----------------------------
2 | 2014-12-15 16:34:05.480178
(1 row)
Time: 2.168 ms
postgres# SELECT *
FROM a
WHERE date(dt) >= '2014-12-15 16:33' AND dt < '2014-12-16 ';
id | dt
----+----------------------------
1 | 2014-12-15 16:32:13.942183
2 | 2014-12-15 16:34:05.480178
(2 rows)
I didn't find the function in docs!! But here is the description:
postgres# \df+ date()
List of functions
Schema | Name | Result data type | Argument data types | Type | Security | Volatility | Owner | Language | Source code | Description
------------+------+------------------+-----------------------------+--------+----------+------------+----------+----------+------------------+------------------------------------------
pg_catalog | date | date | abstime | normal | invoker | stable | postgres | internal | abstime_date | convert abstime to date
pg_catalog | date | date | timestamp without time zone | normal | invoker | immutable | postgres | internal | timestamp_date | convert timestamp to date
pg_catalog | date | date | timestamp with time zone | normal | invoker | stable | postgres | internal | timestamptz_date | convert timestamp with time zone to date
(3 rows)