Databasen - NULL dates

Paul Golds paul.golds at gmail.com
Wed Oct 18 17:19:03 BST 2006


On 10/18/06, David Cantrell <david at cantrell.org.uk> wrote:

> CREATE TABLE fucked_up (
>   date_field_is        ENUM('DATE', 'NULL', 'VERY NULL', 'IMAGINARY',
>                             'FICTIONAL', 'APPROXIMATE', 'WRONG', ...),
>   date_field           VARCHAR(16),
>   ...
> );
>
> May the database gods strike me down for even considering that.

I'm sure they will, you should know to use the XML facilities supplied
by many databases for this just this kind of horrible schema violation
nowadays...

INSERT INTO contacts
  (name,birthday)
VALUES
  ('Trevor','<date year="2006" month="01" day="13" timezone="GMT"
accuracy="Told by Phil, who heard it from a bloke in the pub"
needs_gathering="Yus, certainly"/>')

(Anyone who thinks I'm telling fibs about this kind of support have a
look at http://www.oracle-base.com/articles/9i/XMLTypeDatatype.php ,
or http://www.throwingbeans.org/postgresql_and_xml.html ... but I take
no blame should you have nightmares)


More information about the london.pm mailing list