Обсуждение: Assertion failure due to ColumnRefStar

Поиск
Список
Период
Сортировка

Assertion failure due to ColumnRefStar

От
NikhilS
Дата:
Hi,<br /><br />One of our qmg folks reported an assertion failure:<br /><br />create table x(y char(1));<br />insert
intox  values ("*");<br clear="all" /><br />The above causes the following assertion to be hit:<br /><br />        /*
<br/>         * Target item is a bare '*', expand all tables<br />         *<br />         * (e.g., SELECT * FROM emp,
dept)<br/>         *<br />         * Since the grammar only accepts bare '*' at top level of SELECT, we <br />       
 *need not handle the targetlist==false case here.<br />         */<br />        Assert(targetlist);<br /><br />in
ExpandColumnRefStar()function. <br /><br />I was wondering if we should fix this by checking for
list_length(cref->fields)being greater than 1 before calling this in transformExpressionList? <br /><br
/>Regards,<br/>Nikhils<br />-- <br />EnterpriseDB               <a
href="http://www.enterprisedb.com">http://www.enterprisedb.com</a>

Re: Assertion failure due to ColumnRefStar

От
Heikki Linnakangas
Дата:
NikhilS wrote:
> One of our qmg folks reported an assertion failure:
> 
> create table x(y char(1));
> insert into x  values ("*");
> 
> The above causes the following assertion to be hit:

Works for me on CVS HEAD. Which version of Postgres is this?

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


Re: Assertion failure due to ColumnRefStar

От
Tom Lane
Дата:
Heikki Linnakangas <heikki@enterprisedb.com> writes:
> NikhilS wrote:
>> One of our qmg folks reported an assertion failure:
>> create table x(y char(1));
>> insert into x  values ("*");
>> 
>> The above causes the following assertion to be hit:

> Works for me on CVS HEAD. Which version of Postgres is this?

I see the assert failure here --- maybe you were testing a non-assert
build?

The problem here is that in the output of the grammar, * is represented
exactly the same as "*" would be ... I suppose this representation was
chosen back in the day before we had full support for quoted column
names.
        regards, tom lane


Re: Assertion failure due to ColumnRefStar

От
Tom Lane
Дата:
I wrote:
> The problem here is that in the output of the grammar, * is represented
> exactly the same as "*" would be ... I suppose this representation was
> chosen back in the day before we had full support for quoted column
> names.

I took a brief look at this.  Changing that representation seems like
it'd be a fairly simple exercise, but I don't want to get into doing it
before 8.3 beta, and it'd be too invasive for a back-patch anyway.  What
I propose for the moment is to replace the Assert with a plain elog:
if (!targetlist)    elog(ERROR, "invalid use of *");

Thoughts?
        regards, tom lane