Class AbstractPgFunction

All Implemented Interfaces:
IHashable, IFunction, ISearchPath, IStatement
Direct Known Subclasses:
PgAggregate, PgFunction, PgProcedure

public abstract class AbstractPgFunction extends AbstractFunction
Base implementation of PostgreSQL functions and procedures. Provides common functionality for managing function properties such as language, volatility, security, parallelism, and other PostgreSQL-specific attributes.
  • Field Details

    • FROM_CURRENT

      public static final String FROM_CURRENT
      Constant representing "FROM CURRENT" configuration value for function parameters
      See Also:
  • Method Details

    • getName

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

      Use PgStatement.getBareName() to get just the function name.

      Specified by:
      getName in interface IStatement
      Overrides:
      getName in class PgStatement
      Returns:
      the statement name
    • appendFunctionSignature

      public StringBuilder appendFunctionSignature(StringBuilder sb, boolean includeDefaultValues, boolean includeArgNames)
      Appends signature of statement to sb.
      Parameters:
      sb - StringBuilder to append signature to
      includeDefaultValues - whether to include default values in signature
      includeArgNames - whether to include argument names in signature
      Returns:
      the same StringBuilder instance for chaining
    • setWindow

      public void setWindow(boolean isWindow)
    • getLanguage

      public String getLanguage()
    • setLanguageCost

      public void setLanguageCost(String language, Float cost)
      Sets the function language and cost. Cost is only set if it differs from the default value for the given language type.
      Parameters:
      language - function language
      cost - function execution cost, null to use default
    • setVolatileType

      public void setVolatileType(String volatileType)
    • setStrict

      public void setStrict(boolean isStrict)
    • setSecurityDefiner

      public void setSecurityDefiner(boolean isSecurityDefiner)
    • setLeakproof

      public void setLeakproof(boolean isLeakproof)
    • setRows

      public void setRows(float rows)
    • getParallel

      public String getParallel()
    • setParallel

      public void setParallel(String parallel)
    • setBody

      public void setBody(String body)
    • addTransform

      public void addTransform(String datatype)
      Adds a data type transform for this function.
      Parameters:
      datatype - data type to add transform for
    • addConfiguration

      public void addConfiguration(String par, String val)
      Adds a configuration parameter for this function.
      Parameters:
      par - parameter name
      val - parameter value
    • setSupportFunc

      public void setSupportFunc(String supportFunc)
    • setExecuteOn

      public void setExecuteOn(String executeOn)
    • 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
      Overrides:
      getReturnsColumns in class AbstractFunction
      Returns:
      unmodifiable RETURNS TABLE map
    • addReturnsColumn

      public void addReturnsColumn(String name, String type)
      Adds a column to the RETURNS TABLE definition.
      Parameters:
      name - column name
      type - column type
    • isInStatementBody

      public boolean isInStatementBody()
    • setInStatementBody

      public void setInStatementBody(boolean inStatementBody)
    • getSignature

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

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

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Overrides:
      computeHash in class AbstractFunction
      Parameters:
      hasher - the hasher instance to use for hash computation
    • shallowCopy

      public AbstractFunction shallowCopy()
      Description copied from class: PgStatement
      Copies all object properties into a new object and leaves all its children empty.
      Overrides:
      shallowCopy in class AbstractFunction
      Returns:
      shallow copy of a DB object.
    • getQualifiedName

      public String getQualifiedName()
      Description copied from interface: IStatement
      Gets the fully qualified name of this statement.
      Specified by:
      getQualifiedName in interface IStatement
      Overrides:
      getQualifiedName in class PgStatement
      Returns:
      fully qualified (up to schema) dot-delimited object name. Identifiers are quoted.