The following bug has been logged online:

Bug reference:      1735
Logged by:          Borislav Ivanov
Email address:      [EMAIL PROTECTED]
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)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to