mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Revise handling of oldstyle/newstyle functions per recent discussions
in pghackers list. Support for oldstyle internal functions is gone (no longer needed, since conversion is complete) and pg_language entry 'internal' now implies newstyle call convention. pg_language entry 'newC' is gone; both old and newstyle dynamically loaded C functions are now called language 'C'. A newstyle function must be identified by an associated info routine. See src/backend/utils/fmgr/README.
This commit is contained in:
@ -57,7 +57,7 @@ sub-string will fit.
|
||||
The create the function that contains the trigger::
|
||||
|
||||
create function fti() returns opaque as
|
||||
'/path/to/fti.so' language 'newC';
|
||||
'/path/to/fti.so' language 'C';
|
||||
|
||||
And finally define the trigger on the 'cds' table:
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
Example:
|
||||
|
||||
create function fti() returns opaque as
|
||||
'/home/boekhold/src/postgresql-6.2/contrib/fti/fti.so' language 'newC';
|
||||
'/home/boekhold/src/postgresql-6.2/contrib/fti/fti.so' language 'C';
|
||||
|
||||
create table title_fti (string varchar(25), id oid);
|
||||
create index title_fti_idx on title_fti (string);
|
||||
@ -93,6 +93,8 @@ static int nDeletePlans = 0;
|
||||
static EPlan *find_plan(char *ident, EPlan ** eplan, int *nplans);
|
||||
|
||||
/***********************************************************************/
|
||||
PG_FUNCTION_INFO_V1(fti);
|
||||
|
||||
Datum
|
||||
fti(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
#
|
||||
# create function fti() returns opaque as
|
||||
# '/path/to/fti/file/fti.so'
|
||||
# language 'newC';
|
||||
# language 'C';
|
||||
#
|
||||
# create trigger my_fti_trigger after update or insert or delete
|
||||
# on mytable
|
||||
|
@ -1,3 +1,3 @@
|
||||
create function fti() returns opaque as
|
||||
'MODULE_PATHNAME'
|
||||
language 'newC';
|
||||
language 'C';
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PostgreSQL type definitions for managed LargeObjects.
|
||||
*
|
||||
* $Id: lo.c,v 1.4 2000/06/09 01:10:58 tgl Exp $
|
||||
* $Id: lo.c,v 1.5 2000/11/20 20:36:55 tgl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -140,6 +140,8 @@ lo(Oid oid)
|
||||
/*
|
||||
* This handles the trigger that protects us from orphaned large objects
|
||||
*/
|
||||
PG_FUNCTION_INFO_V1(lo_manage);
|
||||
|
||||
Datum
|
||||
lo_manage(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- PostgreSQL code for LargeObjects
|
||||
--
|
||||
-- $Id: lo.sql.in,v 1.4 2000/06/19 13:53:42 momjian Exp $
|
||||
-- $Id: lo.sql.in,v 1.5 2000/11/20 20:36:55 tgl Exp $
|
||||
--
|
||||
--
|
||||
-- Create the data type
|
||||
@ -44,7 +44,7 @@ create function lo(oid)
|
||||
create function lo_manage()
|
||||
returns opaque
|
||||
as 'MODULE_PATHNAME'
|
||||
language 'newC';
|
||||
language 'C';
|
||||
|
||||
-- This allows us to map lo to oid
|
||||
--
|
||||
|
@ -16,6 +16,8 @@ extern Datum noup(PG_FUNCTION_ARGS);
|
||||
* EXECUTE PROCEDURE noup ('col').
|
||||
*/
|
||||
|
||||
PG_FUNCTION_INFO_V1(noup);
|
||||
|
||||
Datum
|
||||
noup(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -3,5 +3,4 @@ DROP FUNCTION noup ();
|
||||
CREATE FUNCTION noup ()
|
||||
RETURNS opaque
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC'
|
||||
;
|
||||
LANGUAGE 'C';
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pgcrypto.c,v 1.1 2000/10/31 13:11:28 petere Exp $
|
||||
* $Id: pgcrypto.c,v 1.2 2000/11/20 20:36:56 tgl Exp $
|
||||
*/
|
||||
|
||||
#include <postgres.h>
|
||||
@ -59,6 +59,8 @@ find_digest(pg_digest *hbuf, text *name, int silent);
|
||||
|
||||
|
||||
/* SQL function: hash(text, text) returns text */
|
||||
PG_FUNCTION_INFO_V1(digest);
|
||||
|
||||
Datum
|
||||
digest(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@ -95,6 +97,8 @@ digest(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
/* check if given hash exists */
|
||||
PG_FUNCTION_INFO_V1(digest_exists);
|
||||
|
||||
Datum
|
||||
digest_exists(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
CREATE FUNCTION digest(text, text) RETURNS text
|
||||
AS '@MODULE_FILENAME@',
|
||||
'digest' LANGUAGE 'newC';
|
||||
'digest' LANGUAGE 'C';
|
||||
|
||||
CREATE FUNCTION digest_exists(text) RETURNS bool
|
||||
AS '@MODULE_FILENAME@',
|
||||
'digest_exists' LANGUAGE 'newC';
|
||||
'digest_exists' LANGUAGE 'C';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/contrib/soundex/Attic/soundex.c,v 1.7 2000/10/04 19:25:34 petere Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/contrib/soundex/Attic/soundex.c,v 1.8 2000/11/20 20:36:57 tgl Exp $ */
|
||||
#include "postgres.h"
|
||||
#include "fmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
@ -7,11 +7,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
Datum
|
||||
text_soundex(PG_FUNCTION_ARGS);
|
||||
Datum text_soundex(PG_FUNCTION_ARGS);
|
||||
|
||||
static void
|
||||
soundex(const char *instr, char *outstr);
|
||||
static void soundex(const char *instr, char *outstr);
|
||||
|
||||
#define SOUNDEX_LEN 4
|
||||
|
||||
@ -24,6 +22,8 @@ soundex(const char *instr, char *outstr);
|
||||
/*
|
||||
* SQL function: text_soundex(text) returns text
|
||||
*/
|
||||
PG_FUNCTION_INFO_V1(text_soundex);
|
||||
|
||||
Datum
|
||||
text_soundex(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@ -36,6 +36,7 @@ text_soundex(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_TEXT_P(_textin(outstr));
|
||||
}
|
||||
|
||||
#endif /* not SOUNDEX_TEST */
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
CREATE FUNCTION text_soundex(text) RETURNS text
|
||||
AS '@MODULE_FILENAME@', 'text_soundex' LANGUAGE 'newC';
|
||||
AS '@MODULE_FILENAME@', 'text_soundex' LANGUAGE 'C';
|
||||
|
||||
CREATE FUNCTION soundex(text) RETURNS text
|
||||
AS '@MODULE_FILENAME@', 'text_soundex' LANGUAGE 'newC';
|
||||
AS '@MODULE_FILENAME@', 'text_soundex' LANGUAGE 'C';
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
extern Datum autoinc(PG_FUNCTION_ARGS);
|
||||
|
||||
PG_FUNCTION_INFO_V1(autoinc);
|
||||
|
||||
Datum
|
||||
autoinc(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -3,4 +3,4 @@ DROP FUNCTION autoinc();
|
||||
CREATE FUNCTION autoinc()
|
||||
RETURNS opaque
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC';
|
||||
LANGUAGE 'C';
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
extern Datum insert_username(PG_FUNCTION_ARGS);
|
||||
|
||||
PG_FUNCTION_INFO_V1(insert_username);
|
||||
|
||||
Datum
|
||||
insert_username(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -3,4 +3,4 @@ DROP FUNCTION insert_username();
|
||||
CREATE FUNCTION insert_username()
|
||||
RETURNS opaque
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC';
|
||||
LANGUAGE 'C';
|
||||
|
@ -17,6 +17,8 @@ OH, me, I'm Terry Mackintosh <terry@terrym.com>
|
||||
|
||||
extern Datum moddatetime(PG_FUNCTION_ARGS);
|
||||
|
||||
PG_FUNCTION_INFO_V1(moddatetime);
|
||||
|
||||
Datum
|
||||
moddatetime(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -3,4 +3,4 @@ DROP FUNCTION moddatetime();
|
||||
CREATE FUNCTION moddatetime()
|
||||
RETURNS opaque
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC';
|
||||
LANGUAGE 'C';
|
||||
|
@ -36,6 +36,8 @@ static EPlan *find_plan(char *ident, EPlan ** eplan, int *nplans);
|
||||
* check_primary_key ('Fkey1', 'Fkey2', 'Ptable', 'Pkey1', 'Pkey2').
|
||||
*/
|
||||
|
||||
PG_FUNCTION_INFO_V1(check_primary_key);
|
||||
|
||||
Datum
|
||||
check_primary_key(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@ -216,6 +218,8 @@ check_primary_key(PG_FUNCTION_ARGS)
|
||||
* 'Ftable1', 'Fkey11', 'Fkey12', 'Ftable2', 'Fkey21', 'Fkey22').
|
||||
*/
|
||||
|
||||
PG_FUNCTION_INFO_V1(check_foreign_key);
|
||||
|
||||
Datum
|
||||
check_foreign_key(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -4,11 +4,9 @@ DROP FUNCTION check_foreign_key ();
|
||||
CREATE FUNCTION check_primary_key ()
|
||||
RETURNS opaque
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC'
|
||||
;
|
||||
LANGUAGE 'C';
|
||||
|
||||
CREATE FUNCTION check_foreign_key ()
|
||||
RETURNS opaque
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC'
|
||||
;
|
||||
LANGUAGE 'C';
|
||||
|
@ -47,6 +47,8 @@ static EPlan *find_plan(char *ident, EPlan ** eplan, int *nplans);
|
||||
* timetravel ('date_on', 'date_off').
|
||||
*/
|
||||
|
||||
PG_FUNCTION_INFO_V1(timetravel);
|
||||
|
||||
Datum
|
||||
timetravel(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@ -326,6 +328,8 @@ timetravel(PG_FUNCTION_ARGS)
|
||||
* set_timetravel (relname, on) --
|
||||
* turn timetravel for specified relation ON/OFF
|
||||
*/
|
||||
PG_FUNCTION_INFO_V1(set_timetravel);
|
||||
|
||||
Datum
|
||||
set_timetravel(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
@ -4,9 +4,9 @@ DROP FUNCTION set_timetravel(name, int4);
|
||||
CREATE FUNCTION timetravel()
|
||||
RETURNS opaque
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC';
|
||||
LANGUAGE 'C';
|
||||
|
||||
CREATE FUNCTION set_timetravel(name, int4)
|
||||
RETURNS int4
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'newC' WITH (isStrict);
|
||||
LANGUAGE 'C' WITH (isStrict);
|
||||
|
Reference in New Issue
Block a user