diff --git a/lib/SQL/Translator/Parser/PostgreSQL.pm b/lib/SQL/Translator/Parser/PostgreSQL.pm
index ac59c4b..f050ff3 100644
--- a/lib/SQL/Translator/Parser/PostgreSQL.pm
+++ b/lib/SQL/Translator/Parser/PostgreSQL.pm
@@ -631,6 +631,11 @@ pg_data_type :
$return = { type => 'timestamp' . ($2||'') };
}
|
+ /(timetz|time)(?:\(\d\))?( with(?:out)? time zone)?/i
+ {
+ $return = { type => 'time' . ($2||'') };
+ }
+ |
/text/i
{
$return = {
@@ -639,7 +644,7 @@ pg_data_type :
};
}
|
- /(bit|box|cidr|circle|date|inet|line|lseg|macaddr|money|numeric|decimal|path|point|polygon|timetz|time|varchar)/i
+ /(bit|box|cidr|circle|date|inet|line|lseg|macaddr|money|numeric|decimal|path|point|polygon|uuid|varchar)/i
{
$return = { type => $item[1] };
}
diff --git a/t/14postgres-parser.t b/t/14postgres-parser.t
index 3e7e4ea..ffc202f 100644
--- a/t/14postgres-parser.t
+++ b/t/14postgres-parser.t
@@ -29,7 +29,10 @@ my $sql = q{
f_fk1 integer not null references t_test2 (f_id),
f_dropped text,
f_timestamp timestamp(0) with time zone,
- f_timestamp2 timestamp without time zone
+ f_timestamp2 timestamp without time zone,
+ f_uuid uuid,
+ f_time time(0) with time_zone,
+ f_time2 time without time zone
);
create table t_test2 (
@@ -224,6 +227,33 @@ is( $f12->default_value, undef, 'Default value is "undef"' );
is( $f12->is_primary_key, 0, 'Field is not PK' );
is( $f12->is_foreign_key, 0, 'Field is not FK' );
+my $f13 = shift @t1_fields;
+is( $f13->name, 'f_uuid', '13th field is "f_uuid"' );
+is( $f13->data_type, 'uuid', 'Field is a UUID' );
+is( $f13->is_nullable, 1, 'Field can be null' );
+is( $f13->size, 0, 'Size is "0"' );
+is( $f13->default_value, undef, 'Default value is "undef"' );
+is( $f13->is_primary_key, 0, 'Field is not PK' );
+is( $f13->is_foreign_key, 0, 'Field is not FK' );
+
+my $f14 = shift @t1_fields;
+is( $f14->name, 'f_time', '14th field is "f_time"' );
+is( $f14->data_type, 'time with time zone', 'Field is a time with time zone' );
+is( $f14->is_nullable, 1, 'Field can be null' );
+is( $f14->size, 0, 'Size is "0"' );
+is( $f14->default_value, undef, 'Default value is "undef"' );
+is( $f14->is_primary_key, 0, 'Field is not PK' );
+is( $f14->is_foreign_key, 0, 'Field is not FK' );
+
+my $f15 = shift @t1_fields;
+is( $f15->name, 'f_time2', '15th field is "f_time2"' );
+is( $f15->data_type, 'time without time zone', 'Field is a time without time zone' );
+is( $f15->is_nullable, 1, 'Field can be null' );
+is( $f15->size, 0, 'Size is "0"' );
+is( $f15->default_value, undef, 'Default value is "undef"' );
+is( $f15->is_primary_key, 0, 'Field is not PK' );
+is( $f15->is_foreign_key, 0, 'Field is not FK' );
+
# my $fk_ref2 = $f11->foreign_key_reference;
# isa_ok( $fk_ref2, 'SQL::Translator::Schema::Constraint', 'FK' );
# is( $fk_ref2->reference_table, 't_test2', 'FK is to "t_test2" table' );