dbTalk Databases Forums  

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

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1735: row number -1 is out of range 0..-1 error in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Borislav Ivanov
 
Posts: n/a

Default [BUGS] BUG #1735: row number -1 is out of range 0..-1 error - 06-28-2005 , 08:47 AM







The following bug has been logged online:

Bug reference: 1735
Logged by: Borislav Ivanov
Email address: b.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)

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

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Andreas Pflug
 
Posts: n/a

Default Re: [BUGS] BUG #1735: row number -1 is out of range 0..-1 error - 06-28-2005 , 12:11 PM






"3";"12";"0";"7 days

is the result I'm getting in pgadmin.

Regards,
Andreas

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply With Quote
  #3  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1735: row number -1 is out of range 0..-1 error - 06-29-2005 , 08:22 AM



On Tue, Jun 28, 2005 at 07:03:06PM +0200, Andreas Pflug wrote:
Quote:
"3";"12";"0";"7 days

is the result I'm getting in pgadmin.
Same here in psql:

id | seconds | accumulate | period
----+---------+------------+--------
3 | 12 | 0 | 7 days
(1 row)

Borislav, apparently something's different in your environment than
what we're testing with. Locale and encoding maybe? Although I
don't know if or how that would cause the results you're seeing.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
  #4  
Old   
Bobi Ivanov
 
Posts: n/a

Default Re: [BUGS] BUG #1735: row number -1 is out of range 0..-1 error - 06-30-2005 , 10:07 AM



OK, but check this thing out:
(I did my best to replicate this example on another pgSQL server
running on different platform)


CREATE TABLE billingplans (
id int NOT NULL,
reseller_id integer NOT NULL,
base_tariff_id integer NOT NULL,
discount smallint NOT NULL,
freetalktime smallint NOT NULL,
description character varying(255),
status integer DEFAULT 0 NOT NULL,
created timestamp without time zone
);


INSERT INTO billingplans (id, reseller_id, base_tariff_id, discount,
freetalktime, description, status, created) VALUES (5, 1004, 38, 0, 0, 'rt',
1, '2005-06-20 00:00:00');
INSERT INTO billingplans (id, reseller_id, base_tariff_id, discount,
freetalktime, description, status, created) VALUES (1, 1000, 29, 1, 1, 'test
billing plan', 1, NULL);
INSERT INTO billingplans (id, reseller_id, base_tariff_id, discount,
freetalktime, description, status, created) VALUES (7, 1000, 29, 0, 0,
'base', 1, '2005-06-28 00:00:00');


CREATE TABLE billingplans_lots (
plan_id integer NOT NULL,
lot_id integer NOT NULL
);

INSERT INTO billingplans_lots (plan_id, lot_id) VALUES(1, 11);


CREATE TABLE resellerlots (
lotid int NOT NULL,
resellerid integer NOT NULL,
quantity integer DEFAULT 0 NOT NULL,
total numeric(12,4) DEFAULT 0 NOT NULL,
tariffid integer DEFAULT 1 NOT NULL,
lot_desc character(20) NOT NULL,
creation_date timestamp(6) without time zone NOT NULL,
client_type integer NOT NULL,
status integer DEFAULT 0 NOT NULL
);

INSERT INTO resellerlots (lotid, resellerid, quantity, total, tariffid,
lot_desc, creation_date, client_type, status) VALUES (11, 1000, 0, 0.0000,
38, 'testov za plan ', '2005-06-16 14:02:25.711764', 1, 1);
INSERT INTO resellerlots (lotid, resellerid, quantity, total, tariffid,
lot_desc, creation_date, client_type, status) VALUES (9, 1004, 1, 5.0000,
38, 'testov lot ', '2005-06-14 14:47:08.949854', 1, 1);



Then I submit:

SELECT
billingplans.id AS plan_id,
billingplans.description as plan_name
FROM (billingplans inner join billingplans_lots
on billingplans.id = billingplans_lots.plan_id) inner join resellerlots
on billingplans_lots.lot_id = resellerlots.lotid
WHERE resellerlots.lot_desc = 45678 and resellerlots.resellerid = 1000

and this is what I get:


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

I checked this through psql and:

plan_id | plan_name
---------+-----------
(0 rows)




----- Original Message -----
From: "Michael Fuhr" <mike (AT) fuhr (DOT) org>
To: "Andreas Pflug" <pgadmin (AT) pse-consulting (DOT) de>
Cc: "Borislav Ivanov" <b.ivanov (AT) exsisto (DOT) com>; <pgsql-bugs (AT) postgresql (DOT) org>
Sent: Wednesday, June 29, 2005 4:20 PM
Subject: Re: [BUGS] BUG #1735: row number -1 is out of range 0..-1 error


Quote:
On Tue, Jun 28, 2005 at 07:03:06PM +0200, Andreas Pflug wrote:

"3";"12";"0";"7 days

is the result I'm getting in pgadmin.

Same here in psql:

id | seconds | accumulate | period
----+---------+------------+--------
3 | 12 | 0 | 7 days
(1 row)

Borislav, apparently something's different in your environment than
what we're testing with. Locale and encoding maybe? Although I
don't know if or how that would cause the results you're seeing.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


__________ NOD32 1.1157 (20050628) Information __________

This message was checked by NOD32 antivirus system.
http://www.nod32.com



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply With Quote
  #5  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1735: row number -1 is out of range 0..-1 error - 07-01-2005 , 08:37 AM



On Thu, Jun 30, 2005 at 06:03:09PM +0300, Bobi Ivanov wrote:
Quote:
SELECT
billingplans.id AS plan_id,
billingplans.description as plan_name
FROM (billingplans inner join billingplans_lots
on billingplans.id = billingplans_lots.plan_id) inner join resellerlots
on billingplans_lots.lot_id = resellerlots.lotid
WHERE resellerlots.lot_desc = 45678 and resellerlots.resellerid = 1000

and this is what I get:

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

I checked this through psql and:

plan_id | plan_name
---------+-----------
(0 rows)
I get the same result (zero rows) in psql; that appears to be
correct, given the join conditions and the WHERE clause. Maybe
Andreas or somebody else can test the query with pgAdmin.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.