Re: [HACKERS] Almost there on column aliases - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Almost there on column aliases
Date
Msg-id 11110.950603587@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] Re: [HACKERS] Almost there on column aliases  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
List pgsql-hackers
Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> I probably misdiagnosed the behavior, but in any case I'd be *really*
> happy if someone wants to put me out of my misery on this one ;)

At least some of your problems are due to confusing list nodes with the
nodes they point to, as in this example from parse_clause.c:

List *
ListTableAsAttrs(ParseState *pstate, char *table);
List *
ListTableAsAttrs(ParseState *pstate, char *table)
{List *rlist = NULL;List *col;
Attr *attr = expandTable(pstate, table, TRUE);foreach(col, attr->attrs){    Attr *a;    a = makeAttr(table,
strVal((Value*) col));    rlist = lappend(rlist, a);}
 
return rlist;
}

I tried, but failed, to refrain from remarking about the horrible
style of the function declaration --- either it's static (which
looks like the right answer here) or it should be declared in
a header file.  The above method of preventing gcc from telling
you how horrible your style is is just, well, never mind.

The more immediate problem is that you want
    a = makeAttr(table, strVal((Value *) lfirst(col)));

I cleaned up a similar error in ruleutils.c, but am too tired to
fix this one or go digging for more.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: [HACKERS] Solution for LIMIT cost estimation
Next
From: "Kardos, Dr. Andreas"
Date:
Subject: Re: [HACKERS] README.qnx4 -> FAQ_QNX4