SQLite VDBE opcode

CollSeq

P4 is a pointer to a CollSeq object.

An example

6 of the 178 statements we compiled against the sample database use CollSeq. This is the one with the shortest program; the rows that use CollSeq are highlighted.

SELECT max(ms) FROM tracks
addropcodep1p2p3p4p5
0Init01200
1Null0120
2OpenRead04040
3Rewind0800
4Column0330
5CollSeq000BINARY-80
6AggStep032max(1)1
7Next0401
8AggFinal210max(1)0
9Copy2400
10ResultRow4100
11Halt0000
12Transaction00101
13Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: AggFinal, AggStep, Column, Copy, Goto, Halt, Init, Next, Null, OpenRead, ResultRow, Rewind, Transaction.

What the SQLite documentation says

P4 is a pointer to a CollSeq object. If the next call to a user function or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will be returned. This is used by the built-in min(), max() and nullif() functions.

If P1 is not zero, then it is a register that a subsequent min() or max() aggregate will set to 1 if the current row is not the minimum or maximum. The P1 register is initialized to 0 by this instruction.

The interface used by the implementation of the aforementioned functions to retrieve the collation sequence set by this opcode is not available publicly. Only built-in functions have access to this feature.

From sqlite.org's list of opcodes for SQLite 3.54.1, in the public domain. Opcodes are not a stable interface and change between releases.

← ClrSubtype · Column →