($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr, $quote);
is($def->[0], 'CONSTRAINT "constr" UNIQUE ("bar", lower(foo))', 'constraint created w/ quotes');
}
+
+ {
+ my $index = $table->add_index(name => 'myindex', options => [{using => 'hash'}, {where => "upper(foo) = 'bar' AND bar = 'foo'"}], fields => ['bar', 'lower(foo)']);
+ my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index);
+ is($def, "CREATE INDEX myindex on foobar USING hash (bar, lower(foo)) WHERE upper(foo) = 'bar' AND bar = 'foo'", 'index using & where created');
+ ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote);
+ is($def, 'CREATE INDEX "myindex" on "foobar" USING hash ("bar", lower(foo)) WHERE upper(foo) = \'bar\' AND bar = \'foo\'', 'index using & where created w/ quotes');
+ }
}
my $drop_view_opts1 = { add_drop_view => 1, no_comments => 1, postgres_version => 8.001 };