MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / GetLastValue

Method GetLastValue

pkg/sql/sessiondata/sequence_state.go:68–78  ·  view source on GitHub ↗

GetLastValue returns the value most recently obtained by nextval() for the last sequence for which RecordLatestVal() was called.

()

Source from the content-addressed store, hash-verified

66// GetLastValue returns the value most recently obtained by
67// nextval() for the last sequence for which RecordLatestVal() was called.
68func (ss *SequenceState) GetLastValue() (int64, error) {
69 ss.mu.Lock()
70 defer ss.mu.Unlock()
71
72 if !ss.nextValEverCalledLocked() {
73 return 0, pgerror.New(
74 pgcode.ObjectNotInPrerequisiteState, "lastval is not yet defined in this session")
75 }
76
77 return ss.mu.latestValues[ss.mu.lastSequenceIncremented], nil
78}
79
80// GetLastValueByID returns the value most recently obtained by nextval() for
81// the given sequence in this session.

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected