blob: a1307de6f4af812ca596e07249f006b4f9723b58 [file] [log] [blame]
drhc551dd82007-06-19 15:23:48 +00001/*
2** 2007 May 7
3**
4** The author disclaims copyright to this source code. In place of
5** a legal notice, here is a blessing:
6**
7** May you do good and not evil.
8** May you find forgiveness for yourself and forgive others.
9** May you share freely, never taking more than you give.
10**
11*************************************************************************
12**
13** This file defines various limits of what SQLite can process.
14**
drh083e5812008-03-26 15:56:22 +000015** @(#) $Id: sqliteLimit.h,v 1.8 2008/03/26 15:56:22 drh Exp $
drhc551dd82007-06-19 15:23:48 +000016*/
17
18/*
19** The maximum length of a TEXT or BLOB in bytes. This also
20** limits the size of a row in a table or index.
21**
22** The hard limit is the ability of a 32-bit signed integer
23** to count the size: 2^31-1 or 2147483647.
24*/
25#ifndef SQLITE_MAX_LENGTH
26# define SQLITE_MAX_LENGTH 1000000000
27#endif
28
29/*
30** This is the maximum number of
31**
32** * Columns in a table
33** * Columns in an index
34** * Columns in a view
35** * Terms in the SET clause of an UPDATE statement
36** * Terms in the result set of a SELECT statement
37** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
38** * Terms in the VALUES clause of an INSERT statement
39**
40** The hard upper limit here is 32676. Most database people will
41** tell you that in a well-normalized database, you usually should
42** not have more than a dozen or so columns in any table. And if
43** that is the case, there is no point in having more than a few
44** dozen values in any of the other situations described above.
45*/
46#ifndef SQLITE_MAX_COLUMN
47# define SQLITE_MAX_COLUMN 2000
48#endif
49
50/*
51** The maximum length of a single SQL statement in bytes.
drhbb4957f2008-03-20 14:03:29 +000052**
53** It used to be the case that setting this value to zero would
54** turn the limit off. That is no longer true. It is not possible
55** to turn this limit off.
drhc551dd82007-06-19 15:23:48 +000056*/
57#ifndef SQLITE_MAX_SQL_LENGTH
drhbb4957f2008-03-20 14:03:29 +000058# define SQLITE_MAX_SQL_LENGTH 1000000000
drhc551dd82007-06-19 15:23:48 +000059#endif
60
61/*
62** The maximum depth of an expression tree. This is limited to
63** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might
64** want to place more severe limits on the complexity of an
drhbb4957f2008-03-20 14:03:29 +000065** expression.
66**
67** A value of 0 used to mean that the limit was not enforced.
68** But that is no longer true. The limit is now strictly enforced
69** at all times.
drhc551dd82007-06-19 15:23:48 +000070*/
71#ifndef SQLITE_MAX_EXPR_DEPTH
72# define SQLITE_MAX_EXPR_DEPTH 1000
73#endif
74
75/*
76** The maximum number of terms in a compound SELECT statement.
77** The code generator for compound SELECT statements does one
78** level of recursion for each term. A stack overflow can result
79** if the number of terms is too large. In practice, most SQL
80** never has more than 3 or 4 terms. Use a value of 0 to disable
81** any limit on the number of terms in a compount SELECT.
82*/
83#ifndef SQLITE_MAX_COMPOUND_SELECT
84# define SQLITE_MAX_COMPOUND_SELECT 500
85#endif
86
87/*
88** The maximum number of opcodes in a VDBE program.
89** Not currently enforced.
90*/
91#ifndef SQLITE_MAX_VDBE_OP
92# define SQLITE_MAX_VDBE_OP 25000
93#endif
94
95/*
96** The maximum number of arguments to an SQL function.
97*/
98#ifndef SQLITE_MAX_FUNCTION_ARG
99# define SQLITE_MAX_FUNCTION_ARG 100
100#endif
101
102/*
103** The maximum number of in-memory pages to use for the main database
104** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE
105*/
106#ifndef SQLITE_DEFAULT_CACHE_SIZE
107# define SQLITE_DEFAULT_CACHE_SIZE 2000
108#endif
109#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
110# define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500
111#endif
112
113/*
drh083e5812008-03-26 15:56:22 +0000114** The maximum number of attached databases. This must be between 0
115** and 30. The upper bound on 30 is because a 32-bit integer bitmap
116** is used internally to track attached databases.
drhc551dd82007-06-19 15:23:48 +0000117*/
118#ifndef SQLITE_MAX_ATTACHED
119# define SQLITE_MAX_ATTACHED 10
120#endif
121
122
123/*
124** The maximum value of a ?nnn wildcard that the parser will accept.
125*/
126#ifndef SQLITE_MAX_VARIABLE_NUMBER
127# define SQLITE_MAX_VARIABLE_NUMBER 999
128#endif
129
drhf54cc032007-11-05 14:30:22 +0000130/* Maximum page size. The upper bound on this value is 32768. This a limit
131** imposed by the necessity of storing the value in a 2-byte unsigned integer
132** and the fact that the page size must be a power of 2.
133*/
134#ifndef SQLITE_MAX_PAGE_SIZE
135# define SQLITE_MAX_PAGE_SIZE 32768
136#endif
137
138
drhc551dd82007-06-19 15:23:48 +0000139/*
140** The default size of a database page.
141*/
142#ifndef SQLITE_DEFAULT_PAGE_SIZE
143# define SQLITE_DEFAULT_PAGE_SIZE 1024
144#endif
drhf54cc032007-11-05 14:30:22 +0000145#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
146# undef SQLITE_DEFAULT_PAGE_SIZE
147# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
148#endif
drhc551dd82007-06-19 15:23:48 +0000149
danielk19779663b8f2007-08-24 11:52:28 +0000150/*
151** Ordinarily, if no value is explicitly provided, SQLite creates databases
152** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
153** device characteristics (sector-size and atomic write() support),
154** SQLite may choose a larger value. This constant is the maximum value
drh85b623f2007-12-13 21:54:09 +0000155** SQLite will choose on its own.
danielk19779663b8f2007-08-24 11:52:28 +0000156*/
157#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
158# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
159#endif
drhf54cc032007-11-05 14:30:22 +0000160#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
161# undef SQLITE_MAX_DEFAULT_PAGE_SIZE
162# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
drhc551dd82007-06-19 15:23:48 +0000163#endif
164
drhf54cc032007-11-05 14:30:22 +0000165
drhc551dd82007-06-19 15:23:48 +0000166/*
167** Maximum number of pages in one database file.
168**
169** This is really just the default value for the max_page_count pragma.
170** This value can be lowered (or raised) at run-time using that the
171** max_page_count macro.
172*/
173#ifndef SQLITE_MAX_PAGE_COUNT
174# define SQLITE_MAX_PAGE_COUNT 1073741823
175#endif
176
177/*
178** Maximum length (in bytes) of the pattern in a LIKE or GLOB
179** operator.
180*/
181#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
182# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
183#endif