Re: sending row data to frontend - reg

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Rose Catherine K" <rosecatherinek(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sending row data to frontend - reg
Date: 2007-11-05 19:46:45
Message-ID: 26539.1194292005@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Rose Catherine K" <rosecatherinek(at)gmail(dot)com> writes:
> we are trying to modify the source code of postgresql to support a new
> command pivot <colA> <colB> <tablename>
> we are doing the following steps:
> 1. After parsing the input, we are able to get the values entered by the
> user for column A , column B and tablename.
> 2. Then, from postgresmain, we call exec_simple_query with a new query
> "select * from tablename"
> 3. Then we read the result of execution of this query from
> sendrowdescriptionmessage and printtup functions and also, don't allow these
> to send the result of the select query to the frontend
> 4. now, we do the required changes needed for the pivot command
> 5. after this, from executorrun, we call sendrowdescriptionmessage function
> ( with modifications) to send the newly calculated row description - this is
> working fine
> 6. Now, we want to send the newly calculated row data to the frontend. We
> are not able to do this...

It sounds to me like you've kluged the I/O support stuff to the point
that it doesn't work at all. Leave that alone and use SPI to execute
your internal query.

As a general style suggestion, if you are touching postgres.c at all
to add a new command, you are putting it in the wrong place. The guts
of it should be under backend/commands/. I think you ought to look at
existing utility commands that return rows, such as EXPLAIN or SHOW,
for guidance.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2007-11-05 19:52:04 Re: Is necessary to use SEQ_MAXVALUE in pg_dump?
Previous Message Jeff Davis 2007-11-05 19:46:11 Re: Visibility map thoughts