File: sql.txt

package info (click to toggle)
tarantool 1.5.2.20.g5f5d924-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,568 kB
  • ctags: 18,697
  • sloc: ansic: 109,092; sh: 21,312; cpp: 20,633; xml: 9,666; asm: 2,488; python: 2,195; java: 1,759; perl: 1,002; makefile: 679
file content (62 lines) | stat: -rw-r--r-- 1,724 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;
; Tarantool SQL parser is implemented entirely on the client side.
; This BNF provides a reference of the supported subset of
; SQL, to which all clients are strongly encouraged
; to stick.
;
; Convention: UPPERCASE letters are used for terminals and literals.
; Lowercase letters are used for <non-terminals>. SQL is
; case-insensitive, so this convention is present only to improve
; legibility of the BNF.
;
; Tarantool features not supported in SQL:
; - multipart keys
; - update operations, except SET
; - all index-specific queries, such as range queries,  bitset
;   expression evaluation, iteration. These are only available
;   in Lua.

<sql> ::= <insert> | <replace> | <update> | <delete> | <select>

<insert> ::= INSERT [INTO] <ident> VALUES <value_list>

<replace> ::= REPLACE [INTO] <ident> VALUES <value_list>

<update> ::= UPDATE <ident> SET <update_list> <simple_where>

<delete> ::= DELETE FROM <ident> <simple_where>

; It's only possible to select all fields of a tuple (* for field list)
<select> ::= SELECT * FROM <ident> <where> <opt_limit>

<simple_where> ::= WHERE <predicate>

<where> ::= WHERE <disjunction>

<predicate> ::= <ident> = <constant>

<disjunction> ::= <predicate> [{OR <predicate>}+]

; LIMIT is optional
<opt_limit> ::= | LIMIT NUM[, NUM]

<value_list> ::= (<constant> [{, <constant>}+])

<update_list> ::= <ident> = <constant> [{, <ident> = <constant>}+]

<constant> ::= STR | NUM

<ident> ::= ID

; Only integer numbers, optionally signed, are supported
NUM ::= [+-]?[0-9]+

;  Strings must be single-quoted
STR ::= '.*'

; Identifiers must be standard SQL, but end with digits.
; These digits are used to infer the namespace or index id.

ID ::= [a-z_]+[0-9]+

; vim: syntax=bnf