Skip Menu |
 

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 33674
Status: open
Priority: 0/
Queue: SQL-Translator

People
Owner: Nobody in particular
Requestors: DROLSKY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Pg parser's parsing of CHECK breaks on close paren
Download (untitled) / with headers
text/plain 576b
The Pg parser expects a CHECK will break if anything in the check contains a close paren, like this: CHECK ( VALUE ~ E'(.+)' ) The parser stops at the first close paren, which is obviously wrong. I tried fixing this but got a bit stuck. At first I thought I want to match balanced parens, but that's not right since, you can have a valid CHECK with unbalanced parens: CHECK ( VALUES =~ E'^[^)]$' ) I couldn't think of any good solution that didn't involve really parsing what's inside the parens which bound the CHECK rule, and I wasn't even sure how best to do that.
Download (untitled) / with headers
text/plain 868b
Show quoted text
> I couldn't think of any good solution that didn't involve really parsing > what's inside the parens which bound the CHECK rule, and I wasn't even > sure how best to do that.
Quick hack: one level of parrenthsis can be done by replacing: /check/i '(' /[^)]*/ ')' by: /check/i '(' /[^()]*\([^()]*\)[^)]*|[^)]*/ ')' (in SQL/Translator/Parser/PostgreSQL.pm, $GRAMMAR, nonterminals definition `table_constraint_type` and `column_constraint_type`) Better way is (but not tested) (on the same places): /check/i '(' expression ')' and add definition of expression: expression: /[^()]+/ { $return = $item[1]; } | '(' expression ')' { $return = '(' . $item[2] . ')'; } | expression expression { $return = $item[1] . $item[2]; } But this still will not work in case like: CHECK ( name like '%)' )
Download (untitled) / with headers
text/plain 122b
I end up with this patch. Show quoted text
> But this still will not work in case like: > CHECK ( name like '%)' )
This is still bug.
Subject: d
Download d
application/octet-stream 1.4k

Message body not shown because it is not plain text.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.