I'm a beginning developer to postgresql working on a CS Master's project trying to implement a new join operator. My question is how to effectively break down a TupleTableSlot into it's properties. I've been messing around with it for hours now and thought the code below would return the attribute name for table but instead just returns some binary info.

For example, If I have table

TABLE1 with columns (ID, SCORE), I was thinking that the below code would return ID and SCORE as they are the column names. I also need to be able to retrieve the data stored in these columns (select id, score from table1;). Any tips on where to look or find the information I'm looking for would be much appreciated.

TupleTableSlot *slot;
TupleDesc tuple_type;

tuple_type = slot->ttc_tupleDescriptor;

for (i = 0; i < tuple_type->natts; i++)
{
printf("The attname name is %c",tuple_type->attrs[i]->attname.data);

}


Thank You.

Search Discussions

  • Tom Lane at Dec 11, 2004 at 6:47 pm

    "Schoudel, Brian" <BrianS@uillinois.edu> writes:
    I'm a beginning developer to postgresql working on a CS Master's project trying to implement a new join operator. My question is how to effectively break down a TupleTableSlot into it's properties. I've been messing around with it for hours now and thought the code below would return the attribute name for table but instead just returns some binary info.
    The code looks ok as far as it goes ... it's not using NameStr() which I
    would consider good style, but that's just cosmetic.

    What context is this being called in, and where are you getting the slot
    from? I think you're probably not really using a valid slot ...

    regards, tom lane
  • Schoudel, Brian at Dec 13, 2004 at 2:21 pm
    Tom,

    Just for testing, I stuffed it into ExecEvalVar under the switch statement in execQual.c. This was a chosen spot I was fairly certain I could get some kind of output.


    TupleTableSlot *slot;
    TupleDesc tuple_type;

    The above portion is actually part of the delivered source code.

    Maybe I need to as you said wrap a NameStr() around it?

    Thanks

    -----Original Message-----
    From: Tom Lane
    Sent: Saturday, December 11, 2004 12:47 PM
    To: Schoudel, Brian
    Cc: pgsql-hackers@postgresql.org
    Subject: Re: [HACKERS] tuple properties out of TupleTableSlot


    "Schoudel, Brian" <BrianS@uillinois.edu> writes:
    I'm a beginning developer to postgresql working on a CS Master's project trying to implement a new join operator. My question is how to effectively break down a TupleTableSlot into it's properties. I've been messing around with it for hours now and thought the code below would return the attribute name for table but instead just returns some binary info.
    The code looks ok as far as it goes ... it's not using NameStr() which I
    would consider good style, but that's just cosmetic.

    What context is this being called in, and where are you getting the slot
    from? I think you're probably not really using a valid slot ...

    regards, tom lane
  • Tom Lane at Dec 13, 2004 at 4:25 pm

    "Schoudel, Brian" <BrianS@uillinois.edu> writes:
    Just for testing, I stuffed it into ExecEvalVar under the switch statement in execQual.c. This was a chosen spot I was fairly certain I could get some kind of output.
    Oh. In that case you're probably going to be looking at a tupledesc
    that was synthesized by ExecTypeFromTL from a targetlist constructed by
    the planner --- and except at the top level of the plan, the planner
    doesn't bother to assign column names to generated targetlist entries.
    So I'd expect you always get empty-string names, unless you test with a
    trivial one-node scan plan.

    regards, tom lane

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedDec 10, '04 at 8:15p
activeDec 13, '04 at 4:25p
posts4
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Tom Lane: 2 posts Schoudel, Brian: 2 posts

People

Translate

site design / logo © 2022 Grokbase