SQLite VDBE opcode

Copy

Make a copy of registers P1..P1+P3 into registers P2..P2+P3.

An example

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

SELECT sqlite_version()
addropcodep1p2p3p4p5
0Init0600
1Once0300
2Function002sqlite_version(0)0
3Copy2100
4ResultRow1100
5Halt0000
6Goto0100

Open it in the EXPLAIN visualizer →

Also in this program: Function, Goto, Halt, Init, Once, ResultRow.

What the SQLite documentation says

Make a copy of registers P1..P1+P3 into registers P2..P2+P3.

If the 0x0002 bit of P5 is set then also clear the MEM_Subtype flag in the destination. The 0x0001 bit of P5 indicates that this Copy opcode cannot be merged. The 0x0001 bit is used by the query planner and does not come into play during query execution.

This instruction makes a deep copy of the value. A duplicate is made of any string or blob constant. See also SCopy.

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.

← Concat · Count →