Skip to content

Commit 88b8679

Browse files
committed
Improve code readability, explicitly fail for "DEFAULT expr"
1 parent ccf0c80 commit 88b8679

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

wp-includes/sqlite-ast/class-wp-sqlite-information-schema-builder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,11 +2082,13 @@ private function get_column_default( WP_Parser_Node $node ): ?string {
20822082
$bool_literal = $literal->get_first_child_node( 'boolLiteral' );
20832083
return $bool_literal->has_child_token( WP_MySQL_Lexer::TRUE_SYMBOL ) ? '1' : '0';
20842084
}
2085+
2086+
// @TODO: MySQL seems to normalize default values for numeric
2087+
// columns, such as 1.0 to 1, 1e3 to 1000, etc.
2088+
return $this->get_value( $signed_literal );
20852089
}
20862090

2087-
// @TODO: MySQL seems to normalize default values for numeric
2088-
// columns, such as 1.0 to 1, 1e3 to 1000, etc.
2089-
return $this->get_value( $default_attr->get_first_child_node() );
2091+
throw new Exception( 'DEFAULT values with expressions are not yet supported.' );
20902092
}
20912093

20922094
/**

0 commit comments

Comments
 (0)