mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
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
This commit is contained in:
parent
445e31bdc7
commit
f66912b0a0
@ -11,9 +11,8 @@
|
|||||||
<para>
|
<para>
|
||||||
All calls to functions that are written in a language other than
|
All calls to functions that are written in a language other than
|
||||||
the current <quote>version 1</quote> interface for compiled
|
the current <quote>version 1</quote> interface for compiled
|
||||||
languages (this includes functions in user-defined procedural languages,
|
languages (this includes functions in user-defined procedural languages
|
||||||
functions written in SQL, and functions using the version 0 compiled
|
and functions written in SQL) go through a <firstterm>call handler</firstterm>
|
||||||
language interface) go through a <firstterm>call handler</firstterm>
|
|
||||||
function for the specific language. It is the responsibility of
|
function for the specific language. It is the responsibility of
|
||||||
the call handler to execute the function in a meaningful way, such
|
the call handler to execute the function in a meaningful way, such
|
||||||
as by interpreting the supplied source text. This chapter outlines
|
as by interpreting the supplied source text. This chapter outlines
|
||||||
|
@ -4583,17 +4583,19 @@ INSERT INTO a SELECT * FROM a;
|
|||||||
|
|
||||||
PG_MODULE_MAGIC;
|
PG_MODULE_MAGIC;
|
||||||
|
|
||||||
int64 execq(text *sql, int cnt);
|
PG_FUNCTION_INFO_V1(execq);
|
||||||
|
|
||||||
int64
|
Datum
|
||||||
execq(text *sql, int cnt)
|
execq(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
char *command;
|
char *command;
|
||||||
|
int cnt;
|
||||||
int ret;
|
int ret;
|
||||||
uint64 proc;
|
uint64 proc;
|
||||||
|
|
||||||
/* Convert given text object to a C string */
|
/* Convert given text object to a C string */
|
||||||
command = text_to_cstring(sql);
|
command = text_to_cstring(PG_GETARG_TEXT_PP(1));
|
||||||
|
cnt = PG_GETARG_INT32(2);
|
||||||
|
|
||||||
SPI_connect();
|
SPI_connect();
|
||||||
|
|
||||||
@ -4626,16 +4628,10 @@ execq(text *sql, int cnt)
|
|||||||
SPI_finish();
|
SPI_finish();
|
||||||
pfree(command);
|
pfree(command);
|
||||||
|
|
||||||
return proc;
|
PG_RETURN_INT64(proc);
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>
|
|
||||||
(This function uses call convention version 0, to make the example
|
|
||||||
easier to understand. In real applications you should use the new
|
|
||||||
version 1 interface.)
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This is how you declare the function after having compiled it into
|
This is how you declare the function after having compiled it into
|
||||||
a shared library (details are in <xref linkend="dfunc"/>.):
|
a shared library (details are in <xref linkend="dfunc"/>.):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user