@@ -127,6 +127,11 @@ const (
127
127
fnHighlight function = "highlight"
128
128
fnSnippet function = "snippet"
129
129
130
+ // R*Tree functions: https://www.sqlite.org/rtree.html
131
+ fnRTree function = "rtree"
132
+ fnRTreei32 function = "rtree_i32"
133
+ fnRTreeCheck function = "rtreecheck"
134
+
130
135
// Other functions we should allow
131
136
fnVersion function = "sqlite_version"
132
137
)
@@ -221,6 +226,9 @@ var SQLiteFunctions = []function{
221
226
fnFts5Vocab ,
222
227
fnHighlight ,
223
228
fnSnippet ,
229
+ fnRTree ,
230
+ fnRTreei32 ,
231
+ fnRTreeCheck ,
224
232
fnVersion ,
225
233
}
226
234
@@ -232,11 +240,9 @@ func init() {
232
240
}
233
241
234
242
// AuthorizerLive is a SQLite authorizer callback intended to allow almost anything. Except for loading extensions,
235
- // and running pragmas. Note that the "page_size" pragma is always allowed by SQLite, and can't be overridden (any
236
- // attempt to AuthDeny it is ignored)
243
+ // and running pragmas.
237
244
func AuthorizerLive (d interface {}, action sqlite.Action , tableName , funcName , dbName , triggerName string ) sqlite.Auth {
238
245
if SqliteDebug > 0 {
239
- // Display some useful debug info
240
246
log .Printf ("AuthorizerLive - action: '%s', table: '%s', function: '%s'" , action , tableName , funcName )
241
247
}
242
248
@@ -251,6 +257,17 @@ func AuthorizerLive(d interface{}, action sqlite.Action, tableName, funcName, db
251
257
if tableName == "data_version" {
252
258
return sqlite .AuthOk
253
259
}
260
+
261
+ // The "page_size" Pragma is needed when creating R*Tree virtual tables. Ironically, SQLite (3.41.2) ignores
262
+ // any "Deny" of the "page_size" pragma when creating FTS tables. No idea why this difference in behaviour
263
+ // exists, but it doesn't seem to hurt anything.
264
+ if tableName == "page_size" {
265
+ return sqlite .AuthOk
266
+ }
267
+
268
+ if SqliteDebug > 0 {
269
+ log .Printf ("Denying pragma: '%s'" , tableName )
270
+ }
254
271
return sqlite .AuthDeny
255
272
case sqlite .Function :
256
273
if funcName == "load_extension" {
0 commit comments