diff --git a/pg4wp/rewriters/CreateTableSQLRewriter.php b/pg4wp/rewriters/CreateTableSQLRewriter.php index a919124..a19af1a 100644 --- a/pg4wp/rewriters/CreateTableSQLRewriter.php +++ b/pg4wp/rewriters/CreateTableSQLRewriter.php @@ -150,7 +150,7 @@ class CreateTableSQLRewriter extends AbstractSQLRewriter $columnsAndKeys = $matches[3]; $suffix = ')' . $matches[4]; - $regex = '/(?:^|\s*,\s*)(\b(?:timestamp|date|time|default)\b)\s*(?=\s+\w+)/i'; + $regex = '/(?:^|\s*,\s*)(\b(?:timestamp|date|time|default|end)\b)\s*(?=\s+\w+)/i'; // Callback function to add quotes around protected column names $callback = function($matches) { diff --git a/tests/rewriteTest.php b/tests/rewriteTest.php index 7555682..ab40ca2 100644 --- a/tests/rewriteTest.php +++ b/tests/rewriteTest.php @@ -785,6 +785,67 @@ final class rewriteTest extends TestCase $this->assertSame(trim($expected), trim($postgresql)); } + public function test_it_quotes_reserved_columns() + { + $sql = <<assertSame(trim($expected), trim($postgresql)); + } + + protected function setUp(): void { global $wpdb;