Re: [HACKERS] modifying the table function
Hi again It seems now that I am one step away from the end. So far I have succeeded in returing row by row from the backend to the frontend, knew this from debugging. Now comes the point of displaying them directly not to wait till the end of the query. These are the steps I took: 1) redefined 'PrintQueryResults' in common.c to be extern (not static as the initial definition) to be able to use it elsewhere 2) added a declaration for ''PrintQueryResults' in common.h, to tell other files about it 3) removed 'PrintQueryResults' invocation from 'SendQuery' common.c 4) added #include "../bin/psql/common.h" to fe-exec.c 5) called 'PrintQueryResults' from within 'PQexecFinish', last statment in the while loop when I gmake the project I receive the following error: " ../../../src/interfaces/libpq/libpq.so: undefined reference to `PrintQueryTuples' collect2: ld returned 1 exit status gmake[3]: *** [initdb] Error 1 gmake[3]: Leaving directory `/home/grads/imehegaz/postgresql-8.2.3-b/src/bin/initdb' " I wonder what does this error mean and how to solve it? Regards Islam Hegazy - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Islam Hegazy" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, April 18, 2007 6:38 PM Subject: Re: [HACKERS] modifying the table function "Islam Hegazy" <[EMAIL PROTECTED]> writes: I wonder if I am on the right track or not and how to know such kind of message sent from the server? Seems like you're doing it the hard way. Wouldn't it be easier to fix the client to display data before it's received the whole query result? regards, tom lane ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [HACKERS] modifying the table function
"Islam Hegazy" <[EMAIL PROTECTED]> writes: > I wonder if I am on the right track or not and how to know such kind of > message sent from the server? Seems like you're doing it the hard way. Wouldn't it be easier to fix the client to display data before it's received the whole query result? regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [HACKERS] modifying the table function
Thanks for the documentation link. It helped me to understand how data are passed back to the client. I figured out that data is sent back to the client using the 'printtup' function. It is called by ExecSelect, called by ExecutorRun, etc. What I understand now is that the data is sent to the client and stored there until the client receives a message from the server to display it. The server sends the display message from within 'ReadyForQuery' but I can't figure it out. What I expect is that when I call 'exec_simple_query' several times, the server sends one row only for each call. But since they are separate calls, the client overwrites the previous results or saves the new row in a new place in memory such that it displays the last row only when the server invokes 'ReadyForQuery'. I wonder if I am on the right track or not and how to know such kind of message sent from the server? Regards Islam Hegazy - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Islam Hegazy" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, April 17, 2007 1:44 AM Subject: Re: [HACKERS] modifying the table function "Islam Hegazy" <[EMAIL PROTECTED]> writes: My question is how to inform the client that there is a tuple to display = and return back to the backend to continue the query execution? I'd suggest you start by reading http://developer.postgresql.org/pgdocs/postgres/protocol.html and then develop a clear specification at that level of what you think should happen. Perhaps after that exercise it will be clearer how to change the code. "Think first, program later." regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] modifying the table function
"Islam Hegazy" <[EMAIL PROTECTED]> writes: > My question is how to inform the client that there is a tuple to display = > and return back to the backend to continue the query execution? I'd suggest you start by reading http://developer.postgresql.org/pgdocs/postgres/protocol.html and then develop a clear specification at that level of what you think should happen. Perhaps after that exercise it will be clearer how to change the code. "Think first, program later." regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq