Skip to content

Commit f66912b

Browse files
committed
Remove remaining references to version-0 calling convention in docs.
Support for version-0 calling convention was removed in PostgreSQL v10. Change the SPI example to use version 1 convention, so that it actually works. Author: John Naylor Discussion: https://www.postgresql.org/message-id/CAJVSVGVydmhLBdm80Rw3G8Oq5TnA7eCxUv065yoZfNfLbF1tzA@mail.gmail.com
1 parent 445e31b commit f66912b

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

doc/src/sgml/plhandler.sgml

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
<para>
1212
All calls to functions that are written in a language other than
1313
the current <quote>version 1</quote> interface for compiled
14-
languages (this includes functions in user-defined procedural languages,
15-
functions written in SQL, and functions using the version 0 compiled
16-
language interface) go through a <firstterm>call handler</firstterm>
14+
languages (this includes functions in user-defined procedural languages
15+
and functions written in SQL) go through a <firstterm>call handler</firstterm>
1716
function for the specific language. It is the responsibility of
1817
the call handler to execute the function in a meaningful way, such
1918
as by interpreting the supplied source text. This chapter outlines

doc/src/sgml/spi.sgml

+7-11
Original file line numberDiff line numberDiff line change
@@ -4583,17 +4583,19 @@ INSERT INTO a SELECT * FROM a;
45834583

45844584
PG_MODULE_MAGIC;
45854585

4586-
int64 execq(text *sql, int cnt);
4586+
PG_FUNCTION_INFO_V1(execq);
45874587

4588-
int64
4589-
execq(text *sql, int cnt)
4588+
Datum
4589+
execq(PG_FUNCTION_ARGS)
45904590
{
45914591
char *command;
4592+
int cnt;
45924593
int ret;
45934594
uint64 proc;
45944595

45954596
/* Convert given text object to a C string */
4596-
command = text_to_cstring(sql);
4597+
command = text_to_cstring(PG_GETARG_TEXT_PP(1));
4598+
cnt = PG_GETARG_INT32(2);
45974599

45984600
SPI_connect();
45994601

@@ -4626,16 +4628,10 @@ execq(text *sql, int cnt)
46264628
SPI_finish();
46274629
pfree(command);
46284630

4629-
return proc;
4631+
PG_RETURN_INT64(proc);
46304632
}
46314633
</programlisting>
46324634

4633-
<para>
4634-
(This function uses call convention version 0, to make the example
4635-
easier to understand. In real applications you should use the new
4636-
version 1 interface.)
4637-
</para>
4638-
46394635
<para>
46404636
This is how you declare the function after having compiled it into
46414637
a shared library (details are in <xref linkend="dfunc"/>.):

0 commit comments

Comments
 (0)