query first time works second time fails for one connection

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: query first time works second time fails for one connection
Date: 2001-08-01 15:31:12
Message-ID: 200108011531.f71FVC841512@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Rahul Gade (Rahul_g(at)ip(dot)eth(dot)net) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
query first time works second time fails for one connection

Long Description
In fact i want to execute the code which i hade placed in remark, but since the orderby, limit, desc are not supporting here.
I have choosed another option of using temp table for storing result of subquery.
This procedure is getting invoked throug the trigger before/after (both because i have tried it on both event) insert

but in the the time of insertion of data through another procedure
first time it works but for the second time it gives me error as :
ERROR: ExecOpenScanR: failed to open relation 28705

Before second time i am taking care of dropping the temp table tr3.
This command fails for second time in a single connection session but works again in the next connection session to database.

I am not getting why it is failed in second time, while it's working nice in first session.

Hello, Thats not enough, i have found another thing which seems to be a bug.
I can't use the command
drop table tablename
inside the function

I am using postgresql 7.0.2 on redhat 7

Thanks for quick response...

Except these bugs i have facinated with postgresql.It too good than other RDBMS.

Sample Code
create function funNotificationLimit() returns opaque
as
'declare serverId int;
begin
serverId=(select NEW.srvserverid);
create temp table tr as select rptreportid from reporttable
where srvserverid=serverId order by rpttimestamp desc limit 20;
delete from reporttable where srvserverid=serverId and
rptreportid<(select min(rptreportid) from tr);

/* delete from reporttable where srvserverid=serverId and
rptreportid not in(select rptreportid from reporttable
where srvserverid=serverId order by rpttimestamp desc limit 20);*/
return NEW;
end;'
language 'plpgsql';

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message rychu 2001-08-01 15:45:07 Odpowied automatyczna
Previous Message Tom Lane 2001-08-01 14:44:19 Re: When dealing with 'bigint'or 'int8', the command 'copy'doesn't work