Added a handle for DROP TABLE to remove sequences that are linked with the dropped table
git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@546567 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
@@ -207,6 +207,15 @@ WHERE pg_class.relname='$table_name' AND pg_attribute.attnum>=1 AND NOT pg_attri
|
||||
// Now remove handled indexes
|
||||
$sql = preg_replace( $pattern, '', $sql);
|
||||
}// CREATE TABLE
|
||||
elseif( 0 === strpos($sql, 'DROP TABLE'))
|
||||
{
|
||||
$logto = 'DROPTABLE';
|
||||
$pattern = '/DROP TABLE.+ [`]?(\w+)[`]?$/';
|
||||
preg_match($pattern, $sql, $matches);
|
||||
$table = $matches[1];
|
||||
$seq = $table . '_seq';
|
||||
$sql .= ";\nDROP SEQUENCE IF EXISTS $seq;";
|
||||
}// DROP TABLE
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user