Hello X-Tensive,

i'm using DO 4.3 RC3 and PostgreSQL 8.4

if i add a Field with te DateTime Datatype, existing rows get the value "0001-01-01 00:01:00". Comparison with DateTime.MinValue won't fetch in linq queries.

if i set this field explicit to DateTime.MinValue, nothing changes, seems that "0001-01-01 00:01:00" is the same as DateTime.MinValue (suppressed update due to same values?)

if i set this field to any other value and after that to DateTime.MinValue the value of the field is changed to -infinity. (forcing update of field) Comparison with DateTime.MinValue in LINQ queries will fetch

I think added Fields should be set to -infinity and not to 0001-01-01 00:01:00 after creation.

Best regards Thomas


Updated at 22.06.2010 7:34:26

Hello Denis,

i've done some investigation and found, that this only concerns fields added to an existing model (with data). The prostgre sql server creates the column with a statement like this: "LastTimeSuccessful" timestamp without time zone NOT NULL DEFAULT '0001-01-01 00:00:00'::timestamp(6) without time zone All the already exiting rows will have '0001-01-01 00:00:00' and not -inf as value in the new column.

as mentioned previously the problem is that the simple assignment: LastTimeSuccessful = DateTime.MinValue; won't fix this, because DO4 doesn't recognize this as a change.

If you treat DateTime.MinValue like -infinity, you should ensure, that the value '0001-01-01 00:00:00' is never stored in Database. instead you should create the new column with "LastTimeSuccessful" timestamp without time zone NOT NULL DEFAULT '-infinity'::timestamp(6) without time zone to ensure existing rows has an proper value after adding new columns.

Best regards Thomas

This thread was imported from our support forum. The original discussion may contain more detailed answer. Original topic by MSE-iT.

asked Jun 18 '10 at 16:51

Editor's gravatar image

Editor
46153156157

Bug reproduced, thanks. You can track progress here.

(Jun 18 '10 at 16:51) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Hello, Thomas. I've made some investigations. I fail to reproduce this behaviour. Default values for DateTime fields are inserted correctly (as -inf). Could you please provide exact model & test code?

(Jun 18 '10 at 16:51) Denis Krjuchkov Denis%20Krjuchkov's gravatar image
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573

Asked: Jun 18 '10 at 16:51

Seen: 4,260 times

Last updated: Jun 18 '10 at 16:51

powered by OSQA