Hello all,
"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes
> > "Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> > > AFAIC the relation between objects is not copied correctly
> > > by copyObject() (i.e the same pointers to an object are copied
> > > to different pointers by copyObject()).
> >
> > True, but it seems irrelevant to me --- as Jan Wieck was just pointing
> > out, no code should ever depend on pointer-equality in parse trees or
> > plan trees anyway.
> >
> > > There is a way to maintain the list of (old,new) pairs during
> > > copyObject() operations.
> >
> > I think we'd be better off fixing any places that mistakenly assume
> > pointer compare is sufficient. You didn't say which version you were
> > testing,
>
> My environment is v6.4.2.
> OK,I would test my cases again after the release of 6.5-BETA(v6.4.3?).
>
This time,I tested the following 2 cases under CURRENT(99/02/23)
environment and the result was same.
Those bugs are caused by copyObject().
The removal of pointer comparison solves those bugs ?
I don't think so.
I think copyObject() should be more reliable.
I made a patch on trial (see attached file) .
After applying it,both return proper results.
This patch changes the implementaion of copyObject() entirely.
Comments ?
[Case -1]
create function subsel() returns int4
as
'
declare
k int4;
begin
SELECT 1 AS one into k WHERE 1 IN (SELECT 1);
return k;
end;
'
language 'plpgsql';
select subsel();
pqReadData() -- backend closed the channel unexpectedly. This probably means the backend terminated abnormally
beforeor
while pr
ocessing the request.
We have lost the connection to the backend, so further processing is
impossible. Terminating.
[Case-2]
create table grp (key int4);
insert into grp values(2);
insert into grp values(2);
create function grup() returns int4
as
'
declare
k int4;
begin
select key into k from grp
group by key
having count(*) > 1;
return k;
end;
'
language 'plpgsql';
select grup();
The result is
grup
----
(1 row)
Thanks in advance.
Hiroshi Inoue
Inoue@tpf.co.jp