Skip to content

Commit 7071505

Browse files
author
H.Merijn Brand - Tux
committed
more correct describe for combined primary keys
1 parent 10313fc commit 7071505

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/describe.pl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,13 @@ sub usage {
9898
$c->{TYPE}, $dd->{TYPE}[$c->{TYPE}], $cl;
9999
}
100100
else {
101-
$c->{PKEY} and @key = ();
102101
printf " %-23s %-20s%s\t%s%s\n", $cn,
103102
$dd->{TYPE}[$c->{TYPE}], $cl,
104-
$c->{NULLABLE} ? "" : " NOT NULL",
105-
$c->{PKEY} ? " PRIMARY KEY" : "";
103+
$c->{NULLABLE} ? "" : " NOT NULL",
104+
@key < 2 && $c->{PKEY} ? " PRIMARY KEY" : "";
106105
$L and printf "%12s %s\n", "-->", $L;
107106
}
108107
}
109-
@key && !$opt_c and print " PRIMARY KEY (",
108+
@key >= 2 && !$opt_c and print " PRIMARY KEY (",
110109
join (", " => map { $dd->{COLUMN}[$_]{NAME} } @key), ")\n";
111110
}

0 commit comments

Comments
 (0)