MCPcopy Create free account
hub / github.com/dolthub/doltgresql / loadTriggerFunction

Method loadTriggerFunction

server/node/trigger_execution.go:159–181  ·  view source on GitHub ↗

loadTriggerFunction loads the given trigger's framework.InterpretedFunction.

(ctx *sql.Context, trigger triggers.Trigger)

Source from the content-addressed store, hash-verified

157
158// loadTriggerFunction loads the given trigger's framework.InterpretedFunction.
159func (te *TriggerExecution) loadTriggerFunction(ctx *sql.Context, trigger triggers.Trigger) (framework.InterpretedFunction, error) {
160 function, err := loadFunction(ctx, nil, trigger.Function)
161 if err != nil {
162 return framework.InterpretedFunction{}, err
163 }
164 if !function.ID.IsValid() {
165 return framework.InterpretedFunction{}, errors.Errorf("function %s() does not exist", trigger.Function.FunctionName())
166 }
167 if function.ReturnType != pgtypes.Trigger.ID {
168 return framework.InterpretedFunction{}, errors.Errorf(`function %s must return type trigger`, function.ID.FunctionName())
169 }
170 return framework.InterpretedFunction{
171 ID: function.ID,
172 ReturnType: pgtypes.Trigger,
173 ParameterNames: nil,
174 ParameterTypes: nil,
175 Variadic: function.Variadic,
176 IsNonDeterministic: function.IsNonDeterministic,
177 Strict: function.Strict,
178 SRF: false,
179 Statements: function.Operations,
180 }, nil
181}
182
183// triggerExecutionIter is the iterator for TriggerExecution.
184type triggerExecutionIter struct {

Callers 1

BuildRowIterMethod · 0.95

Calls 4

loadFunctionFunction · 0.85
ErrorfMethod · 0.65
IsValidMethod · 0.45
FunctionNameMethod · 0.45

Tested by

no test coverage detected