[HACKERS] Re: [QUESTIONS] Bug ? - Mailing list pgsql-hackers

From Vadim B. Mikheev
Subject [HACKERS] Re: [QUESTIONS] Bug ?
Date
Msg-id 81c1a8acb13d9dc6ea14e0a42c608630
Whole thread Raw
List pgsql-hackers
Edmund Mergl wrote:
>
> Hi,
>
> can anyone tell me please what's wrong with the
> following eample:
>
> bench=> create table tenk1 (gaga varchar(2));
> CREATE
> bench=> create table tenk2 (gaga varchar(2));
> CREATE
> bench=> insert into tenk1 values ('ab');
> INSERT 49020
> bench=> insert into tenk2 values ('ab');
> INSERT 49021
> bench=> select t1.*, t2.gaga as t2gaga into table temp from tenk1 t1, tenk2 t2;
> PQexec() -- Request was sent to backend, but backend closed the channel before responding.  This probably means the
backendterminated abnormally before or while processing the request. 

Yes, we have bug here. It's fix for
execUtils.c:setVarAttrLenForCreateTable()
- ---------
1158c1158
<               rtentry = rt_fetch(var->varno, rangeTable);
- ---
>               rtentry = rt_fetch(var->varnoold, rangeTable);
1162c1162
<                               (*rd->rd_att->attrs[var->varattno-1]).attlen;
- ---
>                               (*rd->rd_att->attrs[var->varoattno-1]).attlen;
- ---------

I changed varno/varattno to varnoold/varoattno: in the case of joins
varno-s may be INNER/OUTER (65000/65001) - you got crash from here, -
varattno-s may be changed too.
They are the same as varno/varattno if no join.

Bruce, comments ?
(I didn't change CVS!)

Vadim

------------------------------

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: [HACKERS] Re: [QUESTIONS] Bug ?
Next
From: "Vadim B. Mikheev"
Date:
Subject: Re: [HACKERS] Re: Need 25 million hackers .......