[Dbix-class] A timestamp field is null when a record is created
Alexander Hartmaier
alexander.hartmaier at t-systems.at
Tue Oct 30 12:54:38 GMT 2012
$obj->discard_changes;
because the database assigns the column value on insert but DBIC doesn't
fetch it from he db.
-Alex
On 2012-10-30 13:47, Robert Rothenberg wrote:
> I have a Postgres table with a timestamp field that defaults to the
> current time:
>
> CREATE TABLE "notes" (
> "id" SERIAL PRIMARY KEY NOT NULL,
> "note" TEXT,
> "created" TIMESTAMP NOT NULL DEFAULT current_timestamp
> );
>
> In a Catalyst application, I create the a record like so:
>
> my $rec = { note => $note };
>
> my $obj = $c->model($NOTE_TABLE)->create($rec);
>
> The record is created, and the "created" field in the database is
> populated with the current time. But $obj->created is undefined.
>
> I have tried it with DBIC 0.08203 and the problem still occurs.
>
> Any ideas what's causing this? Is it a but with DBIC or the
> InflateColumn::DateTime, or something else?
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
More information about the DBIx-Class
mailing list