I have a Postgres table with a timestamp column, like this:
created_on | timestamp without time zone | not null default now()
If I create an instance of this model and let Postgres fill in that
column, like this:
my_model:save(my_model:new_with([{name,"foo"}])
Then it saves, I can look it up with my_model:find_id(Id), etc.
However, if I try to specify the created_on column, like this:
my_model:save(my_model:new_with([{name,"foo"},
{created_on,calendar:universal_time()}])
then erlydb_psql returns an error that looks like this:
{sql_error,
"42804",
"RupdateTargetListEntry L361 Fparse_target.c HYou will need to
rewrite or cast the expression. Mcolumn \"created_on\" is of type
timestamp without time zone but expression is of type bigint"}}
(note that it does this whether I use the format {{_,_,_},{_,_,_}} or
{datetime,{{_,_,_},{_,_,_}}}) This is strange, because
erlydb_field:get_erl_type/1 says:
'timestamp without time zone' -> datetime;
And the docs for erlydb_field:erlydb_type/1 says:
%% @doc Get the field's corresponding Erlang type. Possible values are
%% 'binary', 'integer', 'float', 'date', 'time', and 'datetime'.
%%
%% Date, time and datetime fields have the following forms:
%%
%% ```
%% {date, {Year, Month, Day}}
%% {time, {Hour, Minute, Second}}
%% {datetime, {{Year, Month, Day}, {Hour, Minute, Second}}}
Any ideas on why I can't specify this column?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---