Re: [PATCHES] Re: BUG #4070: Join more then ~15 tables let postgreSQL produces wrong data

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>, "Ceschia, Marcello" <Marcello(dot)Ceschia(at)medizin(dot)uni-leipzig(dot)de>, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: [PATCHES] Re: BUG #4070: Join more then ~15 tables let postgreSQL produces wrong data
Date: 2008-04-03 18:22:29
Message-ID: 47F52065.2030206@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
>> Tom Lane wrote:
>>> I still haven't seen the actual bug description come by here, and the
>>> pgsql-bugs archive hasn't got it either.
>
>> (apparently some mails on that thread are missing ...)
>
> That's what I meant. Heikki is quoting himself from a message that
> hasn't appeared anywhere public, and he must have had at least one
> message from the OP that hasn't appeared either. So the rest of us
> are still mostly in the dark about the problem.

Hmm, strange. Looks like my mail client decided to sent that mail to
pgsql-bugs-owner@ instead of pgsql-bugs@ for some reasone. Here's the
missing mail:

Ceschia, Marcello wrote:
> In query "query_not_working" all values from column "136_119" has the
value of the first column.
>
> Using the splitted query ("working_version") it works.
>
> I hope this data will help to find the bug.

Thanks.

Oh, the query actually gives an assertion failure on an
assertion-enabled build, so this is clearly a bug:

TRAP: FailedAssertion("!(attnum > 0 && attnum <=
list_length(rte->joinaliasvars))", File: "parse_relation.c", Line: 1697)

gdb tells that attnum is -31393 at that point. That's because
get_rte_attribute_type() takes an AttrNumber, which is int16, and
make_var() is trying to pass 34143, so it overflows.

It seems we should extend AttrNumber to int32; we don't use AttrNumber
in any of the on-disk structs. Though you still couldn't have more than
MaxHeapAttributeNumber (1600) attributes in a table or
MaxTupleAttributeNumber (1664) in a result set or intermediate tuples,
like the output of a sort node, at least you could join ridiculously
wide tables like that as long as you project out enough columns.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sam Mason 2008-04-03 18:57:20 Re: BUG #4085: No implicit cast after coalesce
Previous Message John R Pierce 2008-04-03 17:54:10 Re: [PATCHES] Re: BUG #4070: Join more then ~15 tables let postgreSQL produces wrong data

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2008-04-03 18:43:30 Re: psql \G command -- send query and output using extended format
Previous Message Bruce Momjian 2008-04-03 18:18:08 Re: postgresql-icu patch status