Skip to content

Commit 2e8d8d8

Browse files
KES777Eugen Konkov
authored andcommitted
Improve create_index
1 parent 18be6d1 commit 2e8d8d8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/SQL/Translator/Producer/PostgreSQL.pm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,13 @@ sub alter_create_index {
10881088
my ($index, $options) = @_;
10891089
my $generator = _generator($options);
10901090
my ($idef, $constraints) = create_index($index, $options);
1091-
return $index->type eq NORMAL
1091+
1092+
# Just like 90726ffd commit: don't run into output like this:
1093+
# ALTER TABLE users ADD ;
1094+
# create_index returns one of: index definition or constraint
1095+
1096+
# So define index or constraint
1097+
return $idef
10921098
? $idef
10931099
: sprintf('ALTER TABLE %s ADD %s', $generator->quote($index->table->name), join(q{}, @$constraints));
10941100
}

0 commit comments

Comments
 (0)