[SQL] BUG in 7.1.3

2001-09-06 Thread Alessandro Rossi



I think I  have found a bug in version 7.1.3. (I have installed  binary
rpms from postgres site on rh7.1)

Here is the DB and some sample entries.


CREATE TABLE "timetest" (
"id" serial primary key,
"timebegin" time,
"timeend" time
);

insert into timetest (timebegin,timeend) values ('12:00:20','12:01:00');
insert into timetest (timebegin,timeend) values ('14:00:20','14:02:00');
insert into timetest (timebegin,timeend) values ('15:00:00','15:00:40');

WORKS


THIS SELECT DOESN'T WORK: 
select  sum(timeend-timebegin) as totaltime from timetest;

HERE IS WHAT POSTGRES REPORT:

timetest=# select  sum(timeend-timebegin) as totaltime from timetest;
ERROR:  Unable to select an aggregate function sum(time)
timetest=# select version();
   version   
-
 PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.96
(1 row)

timetest=#

ON POSTGRES 7.0.3
timetest=# select  sum(timeend-timebegin) as totaltime from timetest;
 totaltime 
---
 00:03
(1 row)

timetest=# select version();
   version   
-
 PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc 2.96
(1 row)

ascor=# 

Hope this can help to fix the BUG!

Alex



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [SQL] duplicated oid

2001-09-06 Thread Carolyn Lu Wong

anyone knows if duplicated oid is possible?? 

is there a possible way to remove the duplicate row, now that i don't
know which ID to use? any suggestions?

Carolyn Lu Wong wrote:
> 
> i'm using V6.5.
> 
> >From my understanding, the oid should be unique in all rows of database.
> However, I'm getting duplicated data on one particular table, including
> the oid is the same! I don't recall trying to restore nor import any
> data.
> 
> Any idea why?
> 
> ---(end of broadcast)---
> TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [SQL] duplicated oid

2001-09-06 Thread Stephan Szabo

On Fri, 7 Sep 2001, Carolyn Lu Wong wrote:

> anyone knows if duplicated oid is possible?? 
> 
> is there a possible way to remove the duplicate row, now that i don't
> know which ID to use? any suggestions?

Hmm, that's wierd.
AFAIK that should only occur in cases like copy with oids and oid wrap
around (but that'd be unlikely to give you the same row twice).  I'd
guess copy with oids or a plain bug would be more likely.

You can probably use ctid to differentiate between the rows for a delete.

(And you should probably look at upgrading :) )


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [SQL] duplicated oid

2001-09-06 Thread Tom Lane

Carolyn Lu Wong <[EMAIL PROTECTED]> writes:
> anyone knows if duplicated oid is possible?? 

Yes, if you don't have a unique index on it and you've generated more
than four billion rows in the database.

> is there a possible way to remove the duplicate row, now that i don't
> know which ID to use? any suggestions?

Use ctid to distinguish the rows.  Note ctid will change if you update
a row, so it's not a permanent identifier either, but it will serve for
deleting a row.

regards, tom lane

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