java.lang.Object
org.pgcodekeeper.core.database.base.schema.meta.MetaStatement
org.pgcodekeeper.core.database.base.schema.meta.MetaFunction
All Implemented Interfaces:
Serializable, IFunction, ISearchPath, IStatement

public final class MetaFunction extends MetaStatement implements IFunction
Represents a database function metadata object. Stores information about function signatures, arguments, return types, and special properties like SETOF functions and aggregate order by clauses.
See Also:
  • Constructor Details

    • MetaFunction

      public MetaFunction(ObjectLocation object, String bareName)
      Creates a new function metadata object with location information.
      Parameters:
      object - the object location information
      bareName - the bare function name without signature
    • MetaFunction

      public MetaFunction(String schemaName, String name, String bareName)
      Creates a new function metadata object.
      Parameters:
      schemaName - the schema name
      name - the function name (typically the signature)
      bareName - the bare function name without signature
  • Method Details

    • getReturnsColumns

      public Map<String,String> getReturnsColumns()
      Description copied from interface: IFunction
      Gets the return columns for table-valued functions.
      Specified by:
      getReturnsColumns in interface IFunction
      Returns:
      a map of column names to their types
    • addReturnsColumn

      public void addReturnsColumn(String name, String type)
      Adds a column to the returns table for table-returning functions.
      Parameters:
      name - the column name
      type - the column type
    • getArguments

      public List<IArgument> getArguments()
      Description copied from interface: IFunction
      Gets the list of function arguments.
      Specified by:
      getArguments in interface IFunction
      Returns:
      the list of arguments
    • addArgument

      public void addArgument(IArgument arg)
      Adds an argument to this function.
      Parameters:
      arg - the argument to add
    • isSetof

      public boolean isSetof()
      Returns whether this function returns a set of values.
      Returns:
      true if this is a SETOF function, false otherwise
    • setSetof

      public void setSetof(boolean setof)
    • addOrderBy

      public void addOrderBy(Argument type)
      Adds an ORDER BY argument for aggregate functions.
      Parameters:
      type - the order by argument
    • getReturns

      public String getReturns()
      Description copied from interface: IFunction
      Gets the return type of this function.
      Specified by:
      getReturns in interface IFunction
      Returns:
      the return type, or null if not applicable
    • setReturns

      public void setReturns(String returns)
      Description copied from interface: IFunction
      Sets the return type of this function.
      Specified by:
      setReturns in interface IFunction
      Parameters:
      returns - the return type to set
    • needDrop

      public boolean needDrop(IFunction newFunction)
      Description copied from interface: IFunction
      Determines whether this function needs to be dropped before creating the new version.
      Specified by:
      needDrop in interface IFunction
      Parameters:
      newFunction - the new function version to compare against
      Returns:
      true if the function needs to be dropped and recreated
    • getName

      public String getName()
      Alias for getSignature() which provides a unique function ID.

      Use getBareName() to get just the function name.

      Specified by:
      getName in interface IStatement
      Overrides:
      getName in class MetaStatement
      Returns:
      the statement name
    • getBareName

      public String getBareName()
      Description copied from interface: IStatement
      Gets the bare name without qualifiers or arguments.
      Specified by:
      getBareName in interface IStatement
      Overrides:
      getBareName in class MetaStatement
      Returns:
      the bare name
    • getSignature

      public String getSignature()
      Returns function signature. It consists of unquoted name and argument data types.
      Returns:
      function signature
    • getContainingSchema

      public ISchema getContainingSchema()
      Returns the containing schema of this function. This operation is not supported for metadata functions.
      Specified by:
      getContainingSchema in interface ISearchPath
      Returns:
      never returns normally
      Throws:
      IllegalStateException - always thrown as this operation is unsupported
    • getSchemaName

      public String getSchemaName()
      Returns the schema name of this function.
      Specified by:
      getSchemaName in interface ISearchPath
      Returns:
      the schema name