SQLite Forum

Pragma_Function_List()
Login

Pragma_Function_List()

(1) By anonymous on 2021-10-14 13:22:43 [link]

<code>
 name                      builtin type enc  narg   flags
 pow                             1 s    utf8    2 2099200
 group_concat                    1 w    utf8    1 2097152
</code>

How do I interpret (or what are the meanings of):

* type (s = ? w = ?)
* flags

(2.1) By ddevienne on 2021-10-14 14:49:08 edited from 2.0 in reply to 1 [link]

[**s**calar][1], [**a**ggregate][2], and [**w**indow][3] functions (I think).

Not sure about the flags. (See Richard's answer below)

[1]: https://www.sqlite.org/appfunc.html#the_scalar_function_callback
[2]: https://www.sqlite.org/appfunc.html#the_aggregate_function_callbacks
[3]: https://www.sqlite.org/windowfunctions.html

(3) By Richard Hipp (drh) on 2021-10-14 14:04:23 in reply to 1 [link]

The flags column is an internal implementation detail and is subject to change.
But a few of the bits are fixed.  From sqlite3.h:

> ~~~~
#define SQLITE_DETERMINISTIC    0x000000800
#define SQLITE_DIRECTONLY       0x000080000
#define SQLITE_SUBTYPE          0x000100000
#define SQLITE_INNOCUOUS        0x000200000
~~~~

Thus, for example, to see a list of all functions that are not allowed to
be used inside of triggers and views (SQLITE_DIRECTONLY functions) you
could write:

> ~~~~
SELECT DISTINCT name
  FROM pragma_function_list
 WHERE flags & 0x80000
 ORDER BY name;
~~~~

And this gives you:

> ~~~~
┌────────────────────┐
│        name        │
├────────────────────┤
│ fts3_tokenizer     │
│ geopoly_debug      │
│ icu_load_collation │
│ load_extension     │
│ readfile           │
│ sha3_query         │
│ writefile          │
└────────────────────┘
~~~~

(4) By anonymous on 2021-10-14 14:47:10 in reply to 3

<code>
 name                      builtin type enc  narg   flags
 max                             1 s    utf8   ¯1 2099200
 max                             1 w    utf8    1 2097152
 min                             1 s    utf8   ¯1 2099200
 min                             1 w    utf8    1 2097152
</code>

I assume narg stands for the number of arguments;  if so, how do I interpret -1?

(5) By Stephan Beal (stephan) on 2021-10-14 14:59:15 in reply to 4 [link]

> I assume narg stands for the number of arguments; if so, how do I interpret -1?

Variadic: any number of args.