Package org.pgcodekeeper.core.schema.pg
Class AbstractPgFunction
java.lang.Object
org.pgcodekeeper.core.schema.PgStatement
org.pgcodekeeper.core.schema.AbstractFunction
org.pgcodekeeper.core.schema.pg.AbstractPgFunction
- All Implemented Interfaces:
IHashable,IFunction,ISearchPath,IStatement
- Direct Known Subclasses:
PgAggregate,PgFunction,PgProcedure
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassPostgreSQL-specific function argument implementation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant representing "FROM CURRENT" configuration value for function parametersFields inherited from class org.pgcodekeeper.core.schema.PgStatement
GO -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfiguration(String par, String val) Adds a configuration parameter for this function.voidaddReturnsColumn(String name, String type) Adds a column to the RETURNS TABLE definition.voidaddTransform(String datatype) Adds a data type transform for this function.appendFunctionSignature(StringBuilder sb, boolean includeDefaultValues, boolean includeArgNames) Appends signature of statement to sb.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.getName()Alias forgetSignature()which provides a unique function ID.Gets the fully qualified name of this statement.Gets the return columns for table-valued functions.Returns function signature.booleanbooleanneedDrop(AbstractFunction newFunction) Determines whether this function needs to be dropped before creating the new version.voidvoidsetExecuteOn(String executeOn) voidsetInStatementBody(boolean inStatementBody) voidsetLanguageCost(String language, Float cost) Sets the function language and cost.voidsetLeakproof(boolean isLeakproof) voidsetParallel(String parallel) voidsetRows(float rows) voidsetSecurityDefiner(boolean isSecurityDefiner) voidsetStrict(boolean isStrict) voidsetSupportFunc(String supportFunc) voidsetVolatileType(String volatileType) voidsetWindow(boolean isWindow) Copies all object properties into a new object and leaves all its children empty.Methods inherited from class org.pgcodekeeper.core.schema.AbstractFunction
addArgument, appendAlterSQL, canDropBeforeCreate, compare, getArguments, getContainingSchema, getCreationSQL, getReturns, setReturnsMethods inherited from class org.pgcodekeeper.core.schema.PgStatement
addAllDeps, addDep, addPrivilege, appendAlterComments, appendComments, appendOwnerSQL, canDrop, checkComments, clearPrivileges, compareChildren, deepCopy, equals, getAuthor, getBareName, getChildren, getComment, getDbType, getDeps, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getSQL, getTwin, getTypeName, hasChildren, hashCode, isLib, isOwned, isSubElement, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, toStringMethods inherited from interface org.pgcodekeeper.core.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.schema.IStatement
getBareName, getComment, getParent, getStatementType
-
Field Details
-
FROM_CURRENT
Constant representing "FROM CURRENT" configuration value for function parameters- See Also:
-
-
Method Details
-
getName
Alias forgetSignature()which provides a unique function ID.Use
PgStatement.getBareName()to get just the function name.- Specified by:
getNamein interfaceIStatement- Overrides:
getNamein classPgStatement- 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 toincludeDefaultValues- whether to include default values in signatureincludeArgNames- whether to include argument names in signature- Returns:
- the same StringBuilder instance for chaining
-
setWindow
public void setWindow(boolean isWindow) -
getLanguage
-
setLanguageCost
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 languagecost- function execution cost, null to use default
-
setVolatileType
-
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
-
setParallel
-
setBody
-
addTransform
Adds a data type transform for this function.- Parameters:
datatype- data type to add transform for
-
addConfiguration
Adds a configuration parameter for this function.- Parameters:
par- parameter nameval- parameter value
-
setSupportFunc
-
setExecuteOn
-
getReturnsColumns
Description copied from interface:IFunctionGets the return columns for table-valued functions.- Specified by:
getReturnsColumnsin interfaceIFunction- Overrides:
getReturnsColumnsin classAbstractFunction- Returns:
- unmodifiable RETURNS TABLE map
-
addReturnsColumn
Adds a column to the RETURNS TABLE definition.- Parameters:
name- column nametype- column type
-
isInStatementBody
public boolean isInStatementBody() -
setInStatementBody
public void setInStatementBody(boolean inStatementBody) -
getSignature
Returns function signature. It consists of unquoted name and argument data types.- Returns:
- function signature
-
needDrop
Description copied from class:AbstractFunctionDetermines whether this function needs to be dropped before creating the new version.- Specified by:
needDropin classAbstractFunction- Parameters:
newFunction- the new function version to compare against- Returns:
- true if the function needs to be dropped and recreated
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Overrides:
computeHashin classAbstractFunction- Parameters:
hasher- the hasher instance to use for hash computation
-
shallowCopy
Description copied from class:PgStatementCopies all object properties into a new object and leaves all its children empty.- Overrides:
shallowCopyin classAbstractFunction- Returns:
- shallow copy of a DB object.
-
getQualifiedName
Description copied from interface:IStatementGets the fully qualified name of this statement.- Specified by:
getQualifiedNamein interfaceIStatement- Overrides:
getQualifiedNamein classPgStatement- Returns:
- fully qualified (up to schema) dot-delimited object name. Identifiers are quoted.
-