BUG #1735: row number -1 is out of range 0..-1 error

From: "Borislav Ivanov" <b(dot)ivanov(at)exsisto(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1735: row number -1 is out of range 0..-1 error
Date: 2005-06-28 12:18:08
Message-ID: 20050628121808.2F259F0B13@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1735
Logged by: Borislav Ivanov
Email address: b(dot)ivanov(at)exsisto(dot)com
PostgreSQL version: 8.0.3
Operating system: Fedora Core
Description: row number -1 is out of range 0..-1 error
Details:

I get this message 'row number -1 is out of range 0..-1' sometimes. I say
sometimes, because this happens unexpected when I submit absolutely correct
query. This is the last time it happened:

I have two tables:

CREATE TABLE billingplans_freetalktime
(
plan_id int4 NOT NULL,
tariff_id int4 NOT NULL,
seconds int4 NOT NULL,
accumulate int2 NOT NULL,
period interval NOT NULL,
description varchar(255),
id serial NOT NULL
)
WITHOUT OIDS;
ALTER TABLE billingplans_freetalktime OWNER TO ser;

CREATE TABLE tariffs
(
id_tariffs_key serial NOT NULL,
id_tariff int4 NOT NULL,
prefix char(20) NOT NULL,
description char(30) NOT NULL,
voice_rate numeric(8,4) NOT NULL,
from_day int2 NOT NULL,
to_day int2 NOT NULL,
from_hour int2,
to_hour int2 NOT NULL,
CONSTRAINT pk_tariffs PRIMARY KEY (id_tariffs_key),
CONSTRAINT fk_tariffs_id_tariff FOREIGN KEY (id_tariff)
REFERENCES tariffsnames (id_tariff) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITHOUT OIDS;
ALTER TABLE tariffs OWNER TO ser;

and when i submit this query:

select
billingplans_freetalktime.id, billingplans_freetalktime.seconds,
billingplans_freetalktime.accumulate, billingplans_freetalktime.period
from (billingplans_freetalktime inner join tariffs
on billingplans_freetalktime.tariff_id = tariffs.id_tariff)
where billingplans_freetalktime.plan_id = 5
and '3597' like tariffs.prefix||'%'
order by length(tariffs.prefix) desc;

it returns:

row number -1 is out of range 0..-1
Total query runtime: 151 ms.
Data retrieval runtime: 80 ms.
0 rows retrieved.

although there are these rows in each table:

insert into billingplans_freetalktime
values
(5,41,12,0,'7 days','za proba',3)

insert into tariffs
values
(1, 41, '359', 'descr', 12.3, 0, 6, 0, 23)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Fuhr 2005-06-28 12:58:44 Re: row number -1 is out of range 0..-1
Previous Message Bobi Ivanov 2005-06-28 12:11:03 row number -1 is out of range 0..-1