Skip to content

Commit 53945b4

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 d86e9e2 commit 53945b4

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

doc/src/sgml/plhandler.sgml

Lines changed: 2 additions & 3 deletions
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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4355,17 +4355,19 @@ INSERT INTO a SELECT * FROM a;
43554355
PG_MODULE_MAGIC;
43564356
#endif
43574357

4358-
int64 execq(text *sql, int cnt);
4358+
PG_FUNCTION_INFO_V1(execq);
43594359

4360-
int64
4361-
execq(text *sql, int cnt)
4360+
Datum
4361+
execq(PG_FUNCTION_ARGS)
43624362
{
43634363
char *command;
4364+
int cnt;
43644365
int ret;
43654366
uint64 proc;
43664367

43674368
/* Convert given text object to a C string */
4368-
command = text_to_cstring(sql);
4369+
command = text_to_cstring(PG_GETARG_TEXT_PP(1));
4370+
cnt = PG_GETARG_INT32(2);
43694371

43704372
SPI_connect();
43714373

@@ -4398,16 +4400,10 @@ execq(text *sql, int cnt)
43984400
SPI_finish();
43994401
pfree(command);
44004402

4401-
return (proc);
4403+
PG_RETURN_INT64(proc);
44024404
}
44034405
</programlisting>
44044406

4405-
<para>
4406-
(This function uses call convention version 0, to make the example
4407-
easier to understand. In real applications you should use the new
4408-
version 1 interface.)
4409-
</para>
4410-
44114407
<para>
44124408
This is how you declare the function after having compiled it into
44134409
a shared library (details are in <xref linkend="dfunc">.):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy