Re: Error when defining a set returning function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Esteban Zimanyi <ezimanyi(at)ulb(dot)ac(dot)be>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Error when defining a set returning function
Date: 2021-04-16 14:29:35
Message-ID: 4094099.1618583375@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Esteban Zimanyi <ezimanyi(at)ulb(dot)ac(dot)be> writes:
> Since I was receiving an error when defining a set returning function, I
> borrowed a function from PostgreSQL as follows
> ...
> When I execute this function I obtain

> select testSRF(1,10, 2);
> ERROR: unrecognized table-function returnMode: 257

Hmm, I compiled this function up and it works for me:

regression=# select testSRF(1,10, 2);
testsrf
----------
1
3
5
7
(4 rows)

I think your "quick opt-out" code is a bit broken, because it fails to
restore the current memory context; but there's nothing wrong with the
main code path.

Hence, the problem is somewhere else. The first theory that comes
to mind is that you're compiling against Postgres headers that
don't match the server version you're actually loading the code
into. In theory the PG_MODULE_MAGIC infrastructure ought to catch
that, but maybe you've found some creative way to fool that :-(.
One way maybe would be if the headers were from some pre-release
v13 version that wasn't ABI-compatible with 13.0.

Or it could be something else, but I'd counsel looking for build
process mistakes, cause this C code isn't the problem.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-04-16 14:31:35 default_tablespace doc and partitioned rels
Previous Message Alexander Korotkov 2021-04-16 14:25:18 Re: fix old confusing JSON example