Subject: | [PATCH] InflateColumn::DateTime doesn't work with some postgres timestamp field types |
This patch is a minor change to DBIx::Class::InflateColumn::DateTime to
let it support some more timestamp field types found in PostgreSQL,
which may be identified as 'timestamptz', 'timestamp with time zone', or
'timestamp without time zone' in addition to just 'timestamp'.
Index: lib/DBIx/Class/InflateColumn/DateTime.pm
===================================================================
--- lib/DBIx/Class/InflateColumn/DateTime.pm (revision 3263)
+++ lib/DBIx/Class/InflateColumn/DateTime.pm (working copy)
@@ -54,7 +54,7 @@
$self->next::method($column, $info, @rest);
return unless defined($info->{data_type});
my $type = lc($info->{data_type});
- $type = 'datetime' if ($type eq 'timestamp');
+ $type = 'datetime' if ($type =~ /timestamp/);
if ($type eq 'datetime' || $type eq 'date') {
my ($parse, $format) = ("parse_${type}", "format_${type}");
$self->inflate_column(