Subject: | PATCH for 2 different SQL::Translator::Parser::PostgreSQL bugs |
Date: | Mon, 6 Aug 2012 17:03:00 -0400 (EDT) |
To: | bug-SQL-Translator [...] rt.cpan.org |
From: | Doug Miles <dmiles [...] liquidweb.com> |
First of all, thanks for SQL::Translator. It's a great module!
Distro Name and Version: SQL-Translator-0.11012
Perl Version: This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
OS: 2.6.38-8-generic #42-Ubuntu (Linux Mint 11)
Error Message:
Couldn't create table 'network_assignment': Can't create table: "" exists at /usr/local/share/perl/5.10.1/SQL/Translator/Parser/PostgreSQL.pm line 1049.
...propagated at /usr/local/bin/sqlt-diff line 181.
I got the same above error for different tables for both bugs which I will detail below:
Bug 1 - Can't parse table with CHECK with extra parentheses.
SQL: CONSTRAINT network_transposed CHECK ((begin <= end))
Please see tests in attached patch for a complete SQL statement that illustrates the bug.
Description:
The extra parentheses in the CHECK: "((begin <= end))" caused the parser to fail without error. The actual error thrown is because the table information doesn't exists in $tdata->{'table_name'}.
----------
Bug 2 - Can't parse table with DEFAULT of "('now'::text)"
SQL: last_updated timestamp without time zone DEFAULT ('now'::text)::timestamp(6) without time zone NOT NULL
Please see tests in attached patch for a complete SQL statement that illustrates the bug.
Description:
The "('now'::text)" construct causes the parser to fail without error. The actual error thrown is because the table information doesn't exists in $tdata->{'table_name'}.
Attached is a patch file that fixes both bugs and adds tests for both bugs. I don't know if the regex changes are too permissive, but they do not cause any of the existing tests to fail. Please let me know if you need more information. I look forward to a release that fixes these bugs! Thanks!
Doug Miles
Liquid Web, Inc.
dmiles@liquidweb.com
Office: 480.248.9959 x4003
Mobile: 623.262.5568
Fax: 480.248.8785
Message body is not shown because sender requested not to inline it.