Rahul Gade ([EMAIL PROTECTED]) 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 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster