Re: ERROR: table row type and query-specified row type do not match

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Patryk Kordylewski <pk(at)imos(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: table row type and query-specified row type do not match
Date: 2007-08-31 18:37:01
Message-ID: 29665.1188585421@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Patryk Kordylewski <pk(at)imos(dot)net> writes:
> I think i found the problem and made 2 sql files to reproduce it. The
> only difference between this 2 files is the order by-clause of the view...

> http://fooby.imosnet.de/order_by_working.txt
> http://fooby.imosnet.de/order_by_not_working.txt

Hmm, actually you don't even need the rule, any use of a whole-row Var
for that view will fail:

regression=# select v_baz from v_baz;
ERROR: table row type and query-specified row type do not match
DETAIL: Table row contains 3 attributes, but query expects 2.

The problem is that the ORDER BY on a value that's not part of the
output list generates a hidden "resjunk" column in the view, which
confuses ExecEvalVar. I've applied a patch that will appear in 8.2.5.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2007-08-31 18:47:00 Re: auditing in postgresql
Previous Message Madison Kelly 2007-08-31 18:28:56 Re: Select question