CC: | msestak [...] irb.hr |
Subject: | SELECT is broken for large tables |
There is a bug parsing body of response which causes that large SELECTs are broken. SELECTing from a small table is unaffected so this is why this bug went unnoticed.
_read() sub is affected.
Proposed solution is:
sub _read {
my $self = shift;
my @_response;
my $remainder = '';
READBODY: {
my $_bufer;
my $l = $self->{socket}->read_entity_body($_bufer, READ_BUFFER_LENGTH);
$_bufer = $remainder . $_bufer;
$remainder = '';
last unless $l;
if ($_bufer =~ s!([^\n]+\z)!!) {
$remainder = $1;
}
push @_response, split (/\n/, $_bufer);
redo READBODY;
}
return $self->body2array(@_response);
}
See discussion at http://www.perlmonks.org/?node_id=1175544 and thanks Corion for figuring out a problem.