Re: [HACKERS] Almost there on column aliases

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Postgres Hackers List <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Almost there on column aliases
Date: 2000-02-15 08:33:07
Message-ID: 11110.950603587@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Mascari 2000-02-15 08:36:41 Re: [HACKERS] function defined in libpq?
Previous Message Philip Warner 2000-02-15 08:08:09 Re: [HACKERS] Solution for LIMIT cost estimation