Skip Menu |

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

Report information
The Basics
Id: 105625
Status: open
Priority: 0/
Queue: SQL-Abstract

People
Owner: Nobody in particular
Requestors: webstrand [...] gmail.com
Cc:
AdminCc:

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



Subject: SQL::Abstract::Tree's commas incorrectly have higher precedence than string literals
Date: Thu, 2 Jul 2015 16:12:42 -0400
To: bug-sql-abstract [...] rt.cpan.org
From: Webstrand <webstrand [...] gmail.com>
Hello, In SQL::Abstract::Tree, the parse method breaks string literals on commas, producing invalid parse trees. $sqlat->parse(q[ SELECT ',' ]) = [[SELECT => [ [ -LIST => [ [ -LITERAL => [ '\'' ]], [ -LITERAL => [ '\'' ]] ]] ]]]; Also: $sqlat->parse(q[ SELECT GROUP_CONCAT(`field` SEPARATOR ",") ]);
Subject: Re: [rt.cpan.org #105625] SQL::Abstract::Tree's commas incorrectly have higher precedence than string literals
Date: Fri, 03 Jul 2015 08:25:50 +0200
To: bug-SQL-Abstract [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] cpan.org>
On 07/02/2015 10:13 PM, Webstrand via RT wrote: Show quoted text
> In SQL::Abstract::Tree, the parse method breaks string literals on > commas, producing invalid parse trees.
SQLA::Tree at this point is not a full fledged parser (nor is aimed to be one). As it stands it has zero support for any sort of quoting. While this (of course) could be implemented, it is not a high priority for me personally, as the reassembly of the *incorrect* tree till yields something rather close to the original. Or is your use case something else? Please elaborate Cheers
Subject: Re: [rt.cpan.org #105625] SQL::Abstract::Tree's commas incorrectly have higher precedence than string literals
Date: Mon, 6 Jul 2015 15:42:18 -0400
To: bug-SQL-Abstract [...] rt.cpan.org
From: Webstrand <webstrand [...] gmail.com>
On Fri, Jul 3, 2015 at 2:26 AM, Peter Rabbitson via RT wrote: Show quoted text
> While this (of course) could be implemented, it is not a high priority for me > personally, as the reassembly of the *incorrect* tree till yields something > rather close to the original.
For my use case, the unparsed output isn't equivalent to the original. For instance, $sqlat->unparse($sqlat->parse(q[ SELECT example(`field`, ",") ])); produces q[ SELECT example( `field`, ", " ) ] which, with the additional space following the comma inside of the quotation, is not equivalent. Show quoted text
> Or is your use case something else? Please elaborate
I'm using SQLA::Tree to construct new queries using prewritten sql in subqueries. I don't need full support for quotations, I'm not even sure that it's possible to parse quotations in a sql dialect independent manner, I just need to unparse parsed sql and receive something equivalent. I can workaround the problem by passing the prewritten queries to unparse wrapped in a -LITERAL node, but I lose the ability to make additions to the prewritten query, such as adding columns to select or additional where clauses. Thanks