} else {
die "XXX not implemented yet";
}
- $name ||= 'GENSYM__'.++$gensym_count;
+ $name ||= sprintf("GENSYM__%03i",++$gensym_count);
push @inside_select_list, +{
type => DQ_ALIAS,
from => $s,
$order_map{$by}
= $alias_map{join('.', @{$by->{elements}})}
||= do {
- my $name = 'ORDER__BY__'.++$order_gensym_count;
+ my $name = sprintf("ORDER__BY__%03i",++$order_gensym_count);
push @inside_select_list, +{
type => DQ_ALIAS,
from => $by,
type => DQ_SELECT,
select => (
$dq->{preserve_order}
- ? [ @outside_select_list, @order_map{map $_->{by}, @order_nodes} ]
+ ? [
+ @outside_select_list,
+ grep @{$_->{elements}} == 1, @order_map{map $_->{by}, @order_nodes}
+ ]
: \@outside_select_list,
),
from => $outside_order,