mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
SQL-language functions are now callable in ordinary fmgr contexts ...
for example, an SQL function can be used in a functional index. (I make no promises about speed, but it'll work ;-).) Clean up and simplify handling of functions returning sets.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.88 2000/08/20 00:44:18 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.89 2000/08/24 03:29:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -560,13 +560,13 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
|
||||
{ /* we know all of these fields already */
|
||||
|
||||
/*
|
||||
* We create a funcnode with a placeholder function SetEval.
|
||||
* SetEval() never actually gets executed. When the function
|
||||
* evaluation routines see it, they use the funcid projected out
|
||||
* from the relation as the actual function to call. Example:
|
||||
* retrieve (emp.mgr.name) The plan for this will scan the emp
|
||||
* relation, projecting out the mgr attribute, which is a funcid.
|
||||
* This function is then called (instead of SetEval) and "name" is
|
||||
* We create a funcnode with a placeholder function seteval().
|
||||
* At runtime, seteval() will execute the function identified
|
||||
* by the funcid it receives as parameter.
|
||||
*
|
||||
* Example: retrieve (emp.mgr.name). The plan for this will scan the
|
||||
* emp relation, projecting out the mgr attribute, which is a funcid.
|
||||
* This function is then called (via seteval()) and "name" is
|
||||
* projected from its result.
|
||||
*/
|
||||
funcid = F_SETEVAL;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.44 2000/08/08 15:42:04 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.45 2000/08/24 03:29:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -34,7 +34,6 @@
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
static void disallow_setop(char *op, Type optype, Node *operand);
|
||||
static bool fitsInFloat(Value *value);
|
||||
|
||||
|
||||
@ -71,7 +70,6 @@ make_operand(char *opname,
|
||||
|
||||
if (tree != NULL)
|
||||
{
|
||||
disallow_setop(opname, target_type, tree);
|
||||
/* must coerce? */
|
||||
if (target_typeId != orig_typeId)
|
||||
result = coerce_type(NULL, tree, orig_typeId, target_typeId, -1);
|
||||
@ -96,21 +94,6 @@ make_operand(char *opname,
|
||||
} /* make_operand() */
|
||||
|
||||
|
||||
static void
|
||||
disallow_setop(char *op, Type optype, Node *operand)
|
||||
{
|
||||
if (operand == NULL)
|
||||
return;
|
||||
|
||||
if (nodeTag(operand) == T_Iter)
|
||||
{
|
||||
elog(ERROR, "An operand to the '%s' operator returns a set of %s,"
|
||||
"\n\tbut '%s' takes single values, not sets.",
|
||||
op, typeTypeName(optype), op);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* make_op()
|
||||
* Operator construction.
|
||||
*
|
||||
|
Reference in New Issue
Block a user