This strikes me as very odd, and I've looked into trying things like
undef_overrides_default, etc. but haven't a clue where to look next.

I have an RDBO with a timestamp column in Pg. The object is a 'profile'
and is 1-to-1 related to a 'user'. One of the fields of the profile is
supposed to be the time stamp of when they accept the user agreement.

  user_agreement_accepted_on  => { type => 'timestamp', },

As mentioned I have tried this with undef_overrides_default, I've also
tried it with default => undef, and as type 'datetime'. I run through
various code which results in insertion of the new profile, which
amounts to:

my $profile = $user->profile;

...

unless (defined $profile) {
    $user->profile( {} );
}

...

(set other fields in profile, but not user_agreement_accepted_on)

...

$user->save;

At this point the record is saved correctly and
user_agreement_accepted_on is null in the DB. Later within the same
request I do,

my $test = $user->profile->user_agreement_accepted_on;
warn "test: $test\n";
unless (defined $test) {
    ...
}

Which results in 3 log lines,

Use of uninitialized value in concatenation (.) or string at
/.../C/User/Login.pm line 84. --- the warn line
test:
test: 2008-02-11T20:27:17

And the test passes. I later save the $user object (after making
additional changes) and user_agreement_accepted_on is set to what is
essentially the current timestamp.

It seems like a bug that what was previously a null (undef) value would
get initialized when no default value is specified, but more odd is that
the warn line appears to get executed twice, first empty and then
initialized. Which when moving the test directly into the 'unless' check
it still fails, I'm assuming because it too is running twice (however it
is that that happens).

Thoughts? I can eventually write up a formal test case, but I thought
I'd ask first. In the mean time I may have to hack something else
together to meet the deadline.

Thanks for any assistance,

http://danconia.org

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to