diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2015-02-08 16:39:52 +0100 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2015-02-08 16:39:52 +0100 |
| commit | 9cbba89499f9dfcaedf3b7097dbce088e92f6fe8 (patch) | |
| tree | f04e81884c460a7e1ad8c4e32fe0b6b3a6d95ee6 | |
| parent | 161d0aea74787b32ea4c683700365f155551d094 (diff) | |
| parent | 313f0f31e2e67229da32393767d4cf500518815a (diff) | |
| download | sqlparse-9cbba89499f9dfcaedf3b7097dbce088e92f6fe8.tar.gz | |
Merge pull request #169 from darikg/double_precision
(postgresql) Add "double precision" as a built-in datatype
| -rw-r--r-- | sqlparse/lexer.py | 1 | ||||
| -rw-r--r-- | tests/test_parse.py | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index 631c267..611835f 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -200,6 +200,7 @@ class Lexer(object): (r'END(\s+IF|\s+LOOP)?\b', tokens.Keyword), (r'NOT NULL\b', tokens.Keyword), (r'CREATE(\s+OR\s+REPLACE)?\b', tokens.Keyword.DDL), + (r'DOUBLE\s+PRECISION\b', tokens.Name.Builtin), (r'(?<=\.)[^\W\d_]\w*', tokens.Name), (r'[^\W\d_]\w*', is_keyword), (r'[;:()\[\],\.]', tokens.Punctuation), diff --git a/tests/test_parse.py b/tests/test_parse.py index fd48127..2650d7f 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -166,6 +166,14 @@ def test_psql_quotation_marks(): # issue83 assert len(t) == 2 +def test_double_precision_is_builtin(): + sql = 'DOUBLE PRECISION' + t = sqlparse.parse(sql)[0].tokens + assert (len(t) == 1 + and t[0].ttype == sqlparse.tokens.Name.Builtin + and t[0].value == 'DOUBLE PRECISION') + + @pytest.mark.parametrize('ph', ['?', ':1', ':foo', '%s', '%(foo)s']) def test_placeholder(ph): p = sqlparse.parse(ph)[0].tokens @@ -196,3 +204,4 @@ def test_single_quotes_with_linebreaks(): # issue118 p = sqlparse.parse("'f\nf'")[0].tokens assert len(p) == 1 assert p[0].ttype is T.String.Single + |
