Обсуждение: modifying in the libpg files

Поиск
Список
Период
Сортировка

modifying in the libpg files

От
"Islam Hegazy"
Дата:
 
Hi there
I am a grad student in CS University of Calgary. I work on  project to modify the behavior of the table functions to return on iterative base instead of materialization. So far I have succeeded in doing this it seems now that I am one step away from the end. I face a problem now with the front-end, how to display the rows as they are received. That is I want to call 'PrintQueryTuples' from within 'PQexecFinish' instead of 'SendQuery'. 'PQexecFinish' is defined in '../src/interfaces/libpq/fe-exec.c' and 'PrintQueryTuples' is defined in '../src/bin/psql/common.c'
 
I made the following steps:
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' in common.c
4) added #include "../bin/psql/common.h" to fe-exec.c
5) called 'PrintQueryResults' from within 'PQexecFinish', last statement in the while loop
when I gmake the project I receive the following error:
"
../../src/interfaces/libpq/libpq.so: undefined reference to `PrintQueryResults'
collect2: ld returned 1 exit status
gmake[5]: *** [test1] Error 1
gmake[5]: Leaving directory `/home/grads/imehegaz/postgresql-8.2.3-b/src/interfaces/ecpg/test/connect'
gmake[4]: *** [all] Error 2
gmake[4]: Leaving directory `/home/grads/imehegaz/postgresql-8.2.3-b/src/interfaces/ecpg/test'
gmake[3]: *** [all] Error 2
gmake[3]: Leaving directory `/home/grads/imehegaz/postgresql-8.2.3-b/src/interfaces/ecpg'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/home/grads/imehegaz/postgresql-8.2.3-b/src/interfaces'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/home/grads/imehegaz/postgresql-8.2.3-b/src'
gmake: *** [all] Error 2
"
I install Postgresql using the gmake command  under Linux.
 
I wonder what does this error mean and how to solve it?
 
Notice: in the backend, I also invoked functions in different files and directories and I didn't face this problem.

Regards
Islam Hegazy

Re: modifying in the libpg files

От
Tom Lane
Дата:
"Islam Hegazy" <islheg@gmail.com> writes:
> ../../src/interfaces/libpq/libpq.so: undefined reference to =
> `PrintQueryResults'

libpq.so is a shared library --- you can't have it calling functions
that are not in either itself or a shared library it depends on.
You'd have to move PrintQueryTuples bodily into libpq.so to make this
work.  There are various reasons why that's not a great idea, the
main one being that libpq has no idea where psql is intending to
send the output.

IMHO a reasonable solution would involve extending libpq's published API
to allow returning partial query results.  This seems like it could be
made to fit into the PQsendQuery/PQgetResult paradigm, but nobody's
actually done that yet.
        regards, tom lane


Re: modifying in the libpg files

От
"Islam Hegazy"
Дата:
But can you tell me how to let libpq.so depend on the shared library of 
PrintQueryTuples? I need to implement this to show my boss that this final 
step is not applicable.

Also, what is and what do you mean by extending libpq's published API?

Regards
Islam Hegazy


----- Original Message ----- 
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Islam Hegazy" <islheg@gmail.com>
Cc: <pgsql-interfaces@postgresql.org>
Sent: Saturday, April 21, 2007 8:55 PM
Subject: Re: [INTERFACES] modifying in the libpg files


> "Islam Hegazy" <islheg@gmail.com> writes:
>> ../../src/interfaces/libpq/libpq.so: undefined reference to =
>> `PrintQueryResults'
>
> libpq.so is a shared library --- you can't have it calling functions
> that are not in either itself or a shared library it depends on.
> You'd have to move PrintQueryTuples bodily into libpq.so to make this
> work.  There are various reasons why that's not a great idea, the
> main one being that libpq has no idea where psql is intending to
> send the output.
>
> IMHO a reasonable solution would involve extending libpq's published API
> to allow returning partial query results.  This seems like it could be
> made to fit into the PQsendQuery/PQgetResult paradigm, but nobody's
> actually done that yet.
>
> regards, tom lane