CC: | hv [...] crypt.org |
Subject: | SQL::Parser fails to parse insert with functions |
Date: | Sun, 22 Jun 2014 11:07:20 +0100 |
To: | bug-SQL-Statement [...] rt.cpan.org |
From: | hv [...] crypt.org |
This is SQL-Statement-1.405 running on perl-5.16.1.
% ${PERL} -MSQL::Parser -wle '$sp=SQL::Parser->new("AnyData"); \
$sp->parse("insert t1 (c1, c2) values (now(), 1)")'
Bad table or column name: '(' has chars not alphanumeric or underscore! at -e line 1.
%
This comes down to the handling of $val_str in SQL::Parser->INSERT:
while ( $val_str =~ m/\((.+?)\)(?:,|$)/g )
.. which I think would need to find balanced parens to have a chance of
doing the right thing (eg by using Regexp::Common's $RE{balanced}).
Hope this helps,
Hugo