Repository: sqlfluff/sqlfluff
Pull request: Support Double Precision in ANSI
### Brief summary of the change made
Fixes #1523 

### Are there any other side effects of this change that we should be aware of?
Nope. This was already supported in a similar fashion in Exasol.

### Pull Request checklist
- [x] Please confirm you have completed any of the necessary steps below.

- Included test cases to demonstrate any code changes, which may be one or more of the following:
  - `.yml` rule test cases in `test/fixtures/rules/std_rule_cases`.
  - `.sql`/`.yml` parser test cases in `test/fixtures/parser` (note YML files can be auto generated with `python test/generate_parse_fixture_yml.py` or by running `tox` locally).
  - Full autofix test cases in `test/fixtures/linter/autofix`.
  - Other.
- Added appropriate documentation for the change.
- Created GitHub issues for any relevant followup/future enhancements if appropriate.


Problem statement:
sqlfluff 0.6.8 fails on 'double precision' in CREATE TABLE
_If this is a parsing or linting issue, please include a minimal SQL example which reproduces the issue, along with the `sqlfluff parse` output, `sqlfluff lint` output and `sqlfluff fix` output when relevant._

## Expected Behaviour

I'm a new user of sqlfluff but I'm excited to try it on my existing SQL.

I would expect sqlfluff to treat "double precision" declarations as valid SQL.

## Observed Behaviour

Unable to parse section.

## Steps to Reproduce

```shell
$ echo 'CREATE TABLE test ( angle double precision );' | sqlfluff.env/bin/sqlfluff lint -
== [stdin] FAIL
L:   1 | P:   1 |  PRS | Line 1, Position 1: Found unparsable section: 'CREATE
                       | TABLE test ( angle double precisi...'
All Finished 📜 🎉!
$ echo 'CREATE TABLE test ( angle float );' | sqlfluff.env/bin/sqlfluff lint -
All Finished 📜 🎉!
```

## Dialect

ANSI (also tried postgres)

## Version

```
$ sqlfluff.env/bin/sqlfluff --version
sqlfluff, version 0.6.8
$ sqlfluff.env/bin/python3 --version
Python 3.8.10
```
## Configuration

I don't have any sqlfluff configuration files.

Hints from issue discussion:

Commit message: Support Double Precision in ANSI

Patch to review:
diff --git a/src/sqlfluff/dialects/dialect_ansi.py b/src/sqlfluff/dialects/dialect_ansi.py
index 1c5ec425a44..2ccf3c5d7da 100644
--- a/src/sqlfluff/dialects/dialect_ansi.py
+++ b/src/sqlfluff/dialects/dialect_ansi.py
@@ -547,6 +547,7 @@ class DatatypeSegment(BaseSegment):
             Bracketed(Ref("NumericLiteralSegment"), optional=True),
             Sequence(OneOf("WITH", "WITHOUT"), "TIME", "ZONE", optional=True),
         ),
+        Sequence("DOUBLE", Sequence("PRECISION", optional=True),),
         Sequence(
             OneOf(
                 Sequence(
diff --git a/test/fixtures/parser/ansi/create_table_double_precision.sql b/test/fixtures/parser/ansi/create_table_double_precision.sql
new file mode 100644
index 00000000000..28821a3f3e9
--- /dev/null
+++ b/test/fixtures/parser/ansi/create_table_double_precision.sql
@@ -0,0 +1 @@
+CREATE TABLE test ( angle double precision );
diff --git a/test/fixtures/parser/ansi/create_table_double_precision.yml b/test/fixtures/parser/ansi/create_table_double_precision.yml
new file mode 100644
index 00000000000..2faed56e2d3
--- /dev/null
+++ b/test/fixtures/parser/ansi/create_table_double_precision.yml
@@ -0,0 +1,22 @@
+# YML test files are auto-generated from SQL files and should not be edited by
+# hand. To help enforce this, the "hash" field in the file must match a hash
+# computed by SQLFluff when running the tests. Please run
+# `python test/generate_parse_fixture_yml.py`  to generate them after adding or
+# altering SQL files.
+_hash: 6d3a0ef214ac96690502bf67cdab220126c5777f65faf4585d91a9868faa7efd
+file:
+  statement:
+    create_table_statement:
+    - keyword: CREATE
+    - keyword: TABLE
+    - table_reference:
+        identifier: test
+    - bracketed:
+        start_bracket: (
+        column_definition:
+          identifier: angle
+          data_type:
+          - keyword: double
+          - keyword: precision
+        end_bracket: )
+  statement_terminator: ;


Code review comments:
diff_hunk: @@ -547,6 +547,7 @@ class DatatypeSegment(BaseSegment):
             Bracketed(Ref("NumericLiteralSegment"), optional=True),
             Sequence(OneOf("WITH", "WITHOUT"), "TIME", "ZONE", optional=True),
         ),
+        Sequence("DOUBLE", Sequence("PRECISION", optional=True),),
path: src/sqlfluff/dialects/dialect_ansi.py
text: @user1:
Obviously I don't know all of the innards of this parser, and I am not an expert in ANSI SQL, but I did check to see if the "PRECISION" keyword is optional in Postgres, and it is not:

```
$ echo 'CREATE TABLE test ( angle double );' | psql -d test
ERROR:  type "double" does not exist
LINE 1: CREATE TABLE test ( angle double );
```

@author:
Thanks! Updated.