Skip to content

Commit

Permalink
Fixes adding attribute while updating virtual col
Browse files Browse the repository at this point in the history
Fixes phpmyadmin#13105

Signed-off-by: Raghuram Vadapalli<[email protected]>
  • Loading branch information
Achilles-96 authored and nijel committed Mar 20, 2017
1 parent 548b6b4 commit c1b9c83
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions libraries/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,21 +371,21 @@ static function generateFieldSpec($name, $type, $length = '',
// so we can't just convert it to integer
$query .= '(' . $length . ')';
}
if ($attribute != '') {
$query .= ' ' . $attribute;

if ($is_timestamp
&& preg_match('/TIMESTAMP/i', $attribute)
&& strlen($length) !== 0
&& $length !== 0
) {
$query .= '(' . $length . ')';
}
}

if ($virtuality) {
$query .= ' AS (' . $expression . ') ' . $virtuality;
} else {
if ($attribute != '') {
$query .= ' ' . $attribute;

if ($is_timestamp
&& preg_match('/TIMESTAMP/i', $attribute)
&& strlen($length) !== 0
&& $length !== 0
) {
$query .= '(' . $length . ')';
}
}

$matches = preg_match(
'@^(TINYTEXT|TEXT|MEDIUMTEXT|LONGTEXT|VARCHAR|CHAR|ENUM|SET)$@i',
Expand Down

0 comments on commit c1b9c83

Please sign in to comment.