pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedModifying Makefile
2+ messages / 2 participants
[nested] [flat]
* Modifying Makefile
@ 2006-10-14 17:51 Mohamed Yassin Eltabakh <meltabak@cs.purdue.edu>
0 siblings, 1 reply; 2+ messages in thread
From: Mohamed Yassin Eltabakh @ 2006-10-14 17:51 UTC (permalink / raw)
To: pgsql-admin
I'm modifying postgreSQL code and adding a new file (say new.c) under dir
"src/backend/parser". This file calls functions (PSQLexec, PQntuples,
PQgetvalue, ...).
The file looks like:
--------------------------------
#include "libpq-fe.h"
#include "common.h"
bool exec_sql()
{
PGresult *res;
char str[1000];
int TuplesNums;
strcpy(str, "SELECT id, fname FROM T;");
res = PSQLexec(str, false);
if (!res)
return false;
TuplesNums = PQntuples(res);
PQclear(res);
return true;
}
-------------------------
I updated the src/backend/parser/Makefile and added "new.o" to the OBJS
list, but when I compile I receive error:
....undefined reference to `PSQLexec'
....undefined reference to `PQntuples'
....undefined reference to `PQclear'
Do you have an idea which Makefile should I update and how? because I'm not
familiar with writing Makefiles.
Thanks in advance
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Modifying Makefile
@ 2006-10-21 03:47 Tom Lane <tgl@sss.pgh.pa.us>
parent: Mohamed Yassin Eltabakh <meltabak@cs.purdue.edu>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2006-10-21 03:47 UTC (permalink / raw)
To: Mohamed Yassin Eltabakh <meltabak@cs.purdue.edu>; +Cc: pgsql-admin
"Mohamed Yassin Eltabakh" <meltabak@cs.purdue.edu> writes:
> I updated the src/backend/parser/Makefile and added "new.o" to the OBJS
> list, but when I compile I receive error:
> ....undefined reference to `PSQLexec'
> ....undefined reference to `PQntuples'
> ....undefined reference to `PQclear'
You seem to be trying to use the libpq client from inside the backend.
This is entirely inappropriate. If you need to run general-purpose SQL
queries you can use SPI, but code that is doing that probably does not
belong in /parser. Just about anything that makes sense to do during
parse analysis should be adequately supported by the system catalog
cache routines.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-10-21 03:47 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-10-14 17:51 Modifying Makefile Mohamed Yassin Eltabakh <meltabak@cs.purdue.edu>
2006-10-21 03:47 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox