From: | "D(dot) Stimits" <stimits(at)comcast(dot)net> |
---|---|
To: | |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: undefined reference to 'pg_detoast_datum' |
Date: | 2003-10-10 01:47:58 |
Message-ID: | 3F860FCE.8000402@comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joe Conway wrote:
> D. Stimits wrote:
>
> > A google search shows very little concerning the pg_detoast_datum
> > undefined reference link error. It is looking more like the V1 has to
> > be skipped and I'll have to go back to V0 if I can't get this to work.
>
>
> You haven't shown us your function, so it's a bit difficult to help, but
> in any case you do *not* want to use the V0 calling conventions -- they
> are deprecated and subject to removal in the future. V1 certainly works
> -- I've done many V1 C functions that accept text arguments. Take a look
> at some of the contrib folder extensions if you need examples.
>
> > unless someone can magically make the default PostgreSQL version on RH
> > 7.3 change to a newer version of PostgreSQL, then a newer version
> > can't be used]
>
>
> Why not? I have Postgres 7.3.4 running on my RH 7.3 server. Here are RH
> 7.3 RPMs:
> ftp://ftp8.us.postgresql.org/pub/pgsql/binary/v7.3.4/RPMS/redhat-7.3/
I'll consider this, but it greatly complicates things to require users
add the non-redhat version. I understand the benefits of doing so, but
convincing people to do this just to try out a package is not so easy.
>
> Joe
Here is a simple echo function that is being used:
#include <pgsql/server/postgres.h>
#include <string.h>
#include <pgsql/server/fmgr.h>
PG_FUNCTION_INFO_V1(reverse_path);
Datum my_echo(PG_FUNCTION_ARGS)
{
text* arg = PG_GETARG_TEXT_P(0);
text* echo_arg = (text *)palloc(sizeof(arg));
memcpy(
(void *)(echo_arg),
(void *)(arg),
sizeof(arg)
);
PG_RETURN_TEXT_P(echo_arg);
}
Keep in mind that this isn't being run yet, it fails at link stage. As
another test, I have simplified the above just to test link time (not
intended to run, just as a test of link/compile):
#include <pgsql/server/postgres.h>
#include <pgsql/server/fmgr.h>
PG_FUNCTION_INFO_V1(reverse_path);
Datum my_echo(PG_FUNCTION_ARGS)
{
text* arg = PG_GETARG_TEXT_P(0);
PG_RETURN_TEXT_P(arg);
}
The first function complains at link time of missing link function
pg_detoast_datum, CurrentMemoryContext, and MemoryContextAlloc, while
the latter complains only of missing pg_detoast_datum.
In both cases, link libraries are:
-lkrb5 -lk5crypto -lcom_err -lpq -ldl
Now I am still scratching my head, wondering how it is that
pg_detoast_datum is a V0 function, and I can compile V0 libraries just
fine, but can't even compile a V1, which supposedly does not use
pg_detoast_data? The additional link failures when using palloc make me
feel there is some mysterious unnamed library that is missing when using
V1, aside from -lpq. When I go in to compile the src/test/regress/
directory of the source from the rpm used in Redhat 7.3, I see no signs
that anything else is required. Something simple must be missing under
the PostgreSQL 7.2 version. Is there a separate library that needs
linking under a V1 interface, in addition to those named above?
D. Stimits
From | Date | Subject | |
---|---|---|---|
Next Message | Marsh Ray | 2003-10-10 02:04:32 | Re: Response from MySql AB (Re: Humor me: Postgresql vs. |
Previous Message | Chris | 2003-10-10 01:46:20 | Re: Can SQL return a threaded-comment-view result set? |