Documentation patch for to_date and to_timestamp

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Documentation patch for to_date and to_timestamp
Date: 2014-01-21 18:59:41
Message-ID: 52DEC39D.3000505@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The attached patch is in response to ongoing mailing-list questions
regarding perceived weirdness in to_timestamp and to_date.

The patch modifies doc/src/sgml/func.sgml to add "(see usage notes)" in
the description column for to_date and to_timestamp in the Formatting
Functions table and adds the following two list items to the start of
the usage notes for date/time conversion:

The to_date and to_timestamp functions exist to parse unusual input
formats that cannot be handled by casting. These functions interpret
input liberally and with minimal error checking so the conversion has
the potential to yield unexpected results. Read the following notes and
test carefully before use. Casting is the preferred method of conversion
wherever possible.

Input to to_date and to_timestamp is not restricted to normal ranges
thus to_date('20096040','YYYYMMDD') returns 2014-01-17 rather than
generating an error.

Cheers,
Steve

Attachment Content-Type Size
date_timestamp_functions_doc.patch text/x-patch 2.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-01-21 19:06:31 Re: NOT Null constraint on foreign table not working
Previous Message Thom Brown 2014-01-21 18:59:35 Re: Incorrectly reporting config errors