mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-29 17:27:13 +02:00
Fix CHANGE COLUMN matching
The current regex for matching ALTER TABLE CHANGE COLUMN does not match against a statement where there is nothing after the column data type, resulting in errors such as: Error running : ALTER TABLE wp_ngg_pictures CHANGE COLUMN meta_data meta_data LONGTEXT ---- converted to ---- ALTER TABLE wp_ngg_pictures CHANGE COLUMN meta_data meta_data LONGTEXT ----> ERROR: syntax error at or near "CHANGE" LINE 1: ALTER TABLE wp_ngg_pictures CHANGE COLUMN meta_data meta_dat... ^ Fix this by making the space before NOT NULL optional. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
This commit is contained in:
@ -123,7 +123,7 @@ WHERE '.$where : '').';';
|
||||
elseif( 0 === strpos( $sql, 'ALTER TABLE'))
|
||||
{
|
||||
$logto = 'ALTER';
|
||||
$pattern = '/ALTER TABLE\s+(\w+)\s+CHANGE COLUMN\s+([^\s]+)\s+([^\s]+)\s+([^ ]+)( unsigned|)\s+(NOT NULL|)\s*(default (.+)|)/';
|
||||
$pattern = '/ALTER TABLE\s+(\w+)\s+CHANGE COLUMN\s+([^\s]+)\s+([^\s]+)\s+([^ ]+)( unsigned|)\s*(NOT NULL|)\s*(default (.+)|)/';
|
||||
if( 1 === preg_match( $pattern, $sql, $matches))
|
||||
{
|
||||
$table = $matches[1];
|
||||
|
Reference in New Issue
Block a user