Re: A creepy story about dates. How to prevent it? - Mailing list pgsql-general

From Tom Lane
Subject Re: A creepy story about dates. How to prevent it?
Date
Msg-id 4028.1055968917@sss.pgh.pa.us
Whole thread Raw
In response to Re: A creepy story about dates. How to prevent it?  ("scott.marlowe" <scott.marlowe@ihs.com>)
Responses Re: A creepy story about dates. How to prevent it?  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
"scott.marlowe" <scott.marlowe@ihs.com> writes:
> IMHO it is a bug.  We don't let postgresql "guess" about a lot of more
> obvious things (i.e. int4 to int8 casting, etc...) and letting it guess
> about dates makes it non-ACID compliant.

How do you arrive at that conclusion?

> If it isn't a bug, how do I implement a check constraint to stop it from
> happening?  I'd like to know my database accepts properly formatted input
> and rejects the rest.  That's what the C in ACID means, right?

Do the checking in your application.  Something you think is improperly
formatted probably shouldn't get to the database in the first place.
If you aren't doing any format checking at all, you're possibly
vulnerable to SQL injection attacks.

I do now seem to recall an agreement that a GUC switch to disable
date-interpretation guessing would be okay, though.

            regards, tom lane

pgsql-general by date:

Previous
From: Michael Meskes
Date:
Subject: Re: postgreSQL on NAS/SAN?
Next
From: "Sander Steffann"
Date:
Subject: Re: plpython? (Was: Re: Damn triggers and NEW)