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

Method CreateSequence

core/sequences/collection.go:141–154  ·  view source on GitHub ↗

CreateSequence creates a new sequence.

(ctx context.Context, seq *Sequence)

Source from the content-addressed store, hash-verified

139
140// CreateSequence creates a new sequence.
141func (pgs *Collection) CreateSequence(ctx context.Context, seq *Sequence) error {
142 // Ensure that the sequence does not already exist
143 if _, ok := pgs.accessedMap[seq.Id]; ok {
144 return errors.Errorf(`relation "%s" already exists`, seq.Id.SequenceName())
145 }
146 if ok, err := pgs.underlyingMap.Has(ctx, string(seq.Id)); err != nil {
147 return err
148 } else if ok {
149 return errors.Errorf(`relation "%s" already exists`, seq.Id.SequenceName())
150 }
151 // Add it to our cache, which will be emptied when we do anything permanent
152 pgs.accessedMap[seq.Id] = seq
153 return nil
154}
155
156// DropSequence drops existing sequences.
157func (pgs *Collection) DropSequence(ctx context.Context, names ...id.Sequence) (err error) {

Callers 4

PutRootObjectMethod · 0.95
RenameRootObjectMethod · 0.95
OperationPerformerMethod · 0.80
RowIterMethod · 0.80

Calls 3

SequenceNameMethod · 0.80
ErrorfMethod · 0.65
HasMethod · 0.45

Tested by

no test coverage detected