Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

fcache.c

Blame
  • fcache.c 7.62 KiB
    /*-------------------------------------------------------------------------
     *
     * fcache.c
     *	  Code for the 'function cache' used in Oper and Func nodes....
     *
     * Copyright (c) 1994, Regents of the University of California
     *
     *
     * IDENTIFICATION
     *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.22 1999/05/10 00:46:06 momjian Exp $
     *
     *-------------------------------------------------------------------------
     */
    #include "postgres.h"
    
    #include <nodes/parsenodes.h>
    #include <fmgr.h>
    
    #include "access/htup.h"
    #include "utils/catcache.h"
    #include "utils/syscache.h"
    #include "catalog/pg_type.h"
    #include "catalog/pg_proc.h"
    #include "catalog/pg_language.h"
    #include "catalog/pg_class.h"
    #include "parser/parsetree.h"	/* for getrelname() */
    #include "utils/builtins.h"
    #include "utils/fcache.h"
    #include "utils/fcache2.h"
    #include "nodes/primnodes.h"
    #include "nodes/execnodes.h"
    #ifndef HAVE_MEMMOVE
    #include <regex/utils.h>
    #else
    #include <string.h>
    #endif
    
    static Oid	GetDynamicFuncArgType(Var *arg, ExprContext *econtext);
    static FunctionCachePtr init_fcache(Oid foid,
    			bool use_syscache,
    			List *argList,
    			ExprContext *econtext);
    
    /*-----------------------------------------------------------------
     *
     * Initialize the 'FunctionCache' given the PG_PROC oid.
     *
     *
     * NOTE:  This function can be called when the system cache is being
     *		  initialized.	Therefore, use_syscache should ONLY be true
     *		  when the function return type is interesting (ie: set_fcache).
     *-----------------------------------------------------------------
     */
    #define FuncArgTypeIsDynamic(arg) \
    	(IsA(arg,Var) && ((Var*)arg)->varattno == InvalidAttrNumber)
    
    static Oid
    GetDynamicFuncArgType(Var *arg, ExprContext *econtext)
    {
    	char	   *relname;
    	int			rtid;
    	HeapTuple	tup;
    
    	Assert(IsA(arg, Var));
    
    	rtid = ((Var *) arg)->varno;
    	relname = (char *) getrelname(rtid, econtext->ecxt_range_table);
    
    
    	tup = SearchSysCacheTuple(TYPNAME,