Repository: sqlfluff/sqlfluff
Issue category: Bug Report

Handling of MATCH_BY_COLUMN_NAME in COPY INTO parameters in Snowflake dialect
### Search before asking

- [X] I searched the [issues](https://github.com/sqlfluff/sqlfluff/issues) and found no similar issues.


### What Happened

The following query triggers a parsing error: 
```
CREATE TABLE IF NOT EXISTS test.transactions_all (
    transaction_id TEXT,
    transaction_amount TEXT
);

COPY INTO test.transactions_all
FROM @rawdata.STITCH_STAGE_NETSUITE/transactions/
FILE_FORMAT = rawdata.json_format
MATCH_BY_COLUMN_NAME = 'case_insensitive';
```

Whereas the following does not: 
```
CREATE TABLE IF NOT EXISTS test.transactions_all (
    transaction_id TEXT,
    transaction_amount TEXT
);

COPY INTO test.transactions_all
FROM @rawdata.STITCH_STAGE_NETSUITE/transactions/
FILE_FORMAT = rawdata.json_format
MATCH_BY_COLUMN_NAME = CASE_INSENSITIVE;
```

While it's not the same exact error, it feels closely related to [this issue](https://github.com/sqlfluff/sqlfluff/issues/5925)

### Expected Behaviour

Linting should not reveal any errors

### Observed Behaviour

Here is the output of sqlfluff parse for the unparseable code: 
```
[L:  1, P:  1]      |file:
[L:  1, P:  1]      |    statement:
[L:  1, P:  1]      |        create_table_statement:
[L:  1, P:  1]      |            keyword:                                          'CREATE'
[L:  1, P:  7]      |            whitespace:                                       ' '
[L:  1, P:  8]      |            keyword:                                          'TABLE'
[L:  1, P: 13]      |            whitespace:                                       ' '
[L:  1, P: 14]      |            keyword:                                          'IF'
[L:  1, P: 16]      |            whitespace:                                       ' '
[L:  1, P: 17]      |            keyword:                                          'NOT'
[L:  1, P: 20]      |            whitespace:                                       ' '
[L:  1, P: 21]      |            keyword:                                          'EXISTS'
[L:  1, P: 27]      |            whitespace:                                       ' '
[L:  1, P: 28]      |            table_reference:
[L:  1, P: 28]      |                naked_identifier:                             'test'
[L:  1, P: 32]      |                dot:                                          '.'
[L:  1, P: 33]      |                naked_identifier:                             'transactions_all'
[L:  1, P: 49]      |            whitespace:                                       ' '
[L:  1, P: 50]      |            bracketed:
[L:  1, P: 50]      |                start_bracket:                                '('
[L:  1, P: 51]      |                [META] indent:
[L:  1, P: 51]      |                newline:                                      '\n'
[L:  2, P:  1]      |                whitespace:                                   '    '
[L:  2, P:  5]      |                column_definition:
[L:  2, P:  5]      |                    naked_identifier:                         'transaction_id'
[L:  2, P: 19]      |                    whitespace:                               ' '
[L:  2, P: 20]      |                    data_type:
[L:  2, P: 20]      |                        data_type_identifier:                 'TEXT'
[L:  2, P: 24]      |                comma:                                        ','
[L:  2, P: 25]      |                newline:                                      '\n'
[L:  3, P:  1]      |                whitespace:                                   '    '
[L:  3, P:  5]      |                column_definition:
[L:  3, P:  5]      |                    naked_identifier:                         'transaction_amount'
[L:  3, P: 23]      |                    whitespace:                               ' '
[L:  3, P: 24]      |                    data_type:
[L:  3, P: 24]      |                        data_type_identifier:                 'TEXT'
[L:  3, P: 28]      |                newline:                                      '\n'
[L:  4, P:  1]      |                [META] dedent:
[L:  4, P:  1]      |                end_bracket:                                  ')'
[L:  4, P:  2]      |    statement_terminator:                                     ';'
[L:  4, P:  3]      |    newline:                                                  '\n'
[L:  5, P:  1]      |    newline:                                                  '\n'
[L:  6, P:  1]      |    statement:
[L:  6, P:  1]      |        copy_into_table_statement:
[L:  6, P:  1]      |            keyword:                                          'COPY'
[L:  6, P:  5]      |            whitespace:                                       ' '
[L:  6, P:  6]      |            keyword:                                          'INTO'
[L:  6, P: 10]      |            whitespace:                                       ' '
[L:  6, P: 11]      |            table_reference:
[L:  6, P: 11]      |                naked_identifier:                             'test'
[L:  6, P: 15]      |                dot:                                          '.'
[L:  6, P: 16]      |                naked_identifier:                             'transactions_all'
[L:  6, P: 32]      |            newline:                                          '\n'
[L:  7, P:  1]      |            keyword:                                          'FROM'
[L:  7, P:  5]      |            whitespace:                                       ' '
[L:  7, P:  6]      |            storage_location:
[L:  7, P:  6]      |                stage_path:                                   '@rawdata.STITCH_STAGE_NETSUITE/transactions/'
[L:  7, P: 50]      |            newline:                                          '\n'
[L:  8, P:  1]      |            keyword:                                          'FILE_FORMAT'
[L:  8, P: 12]      |            whitespace:                                       ' '
[L:  8, P: 13]      |            comparison_operator:
[L:  8, P: 13]      |                raw_comparison_operator:                      '='
[L:  8, P: 14]      |            whitespace:                                       ' '
[L:  8, P: 15]      |            file_format_segment:
[L:  8, P: 15]      |                object_reference:
[L:  8, P: 15]      |                    naked_identifier:                         'rawdata'
[L:  8, P: 22]      |                    dot:                                      '.'
[L:  8, P: 23]      |                    naked_identifier:                         'json_format'
[L:  8, P: 34]      |    newline:                                                  '\n'
[L:  9, P:  1]      |    unparsable:                                               !! Expected: 'Nothing else in FileSegment.'
[L:  9, P:  1]      |        word:                                                 'MATCH_BY_COLUMN_NAME'
[L:  9, P: 21]      |        whitespace:                                           ' '
[L:  9, P: 22]      |        equals:                                               '='
[L:  9, P: 23]      |        whitespace:                                           ' '
[L:  9, P: 24]      |        single_quote:                                         "'case_insensitive'"
[L:  9, P: 42]      |        semicolon:                                            ';'
[L:  9, P: 43]      |    [META] end_of_file:

==== parsing violations ====
L:   9 | P:   1 |  PRS | Line 9, Position 1: Found unparsable section:
                       | "MATCH_BY_COLUMN_NAME = 'case_insensitive..."
WARNING: Parsing errors found and dialect is set to 'snowflake'. Have you configured your dialect correctly?
```

Here is the output when it passes: 
```
[L:  1, P:  1]      |file:
[L:  1, P:  1]      |    statement:
[L:  1, P:  1]      |        create_table_statement:
[L:  1, P:  1]      |            keyword:                                          'CREATE'
[L:  1, P:  7]      |            whitespace:                                       ' '
[L:  1, P:  8]      |            keyword:                                          'TABLE'
[L:  1, P: 13]      |            whitespace:                                       ' '
[L:  1, P: 14]      |            keyword:                                          'IF'
[L:  1, P: 16]      |            whitespace:                                       ' '
[L:  1, P: 17]      |            keyword:                                          'NOT'
[L:  1, P: 20]      |            whitespace:                                       ' '
[L:  1, P: 21]      |            keyword:                                          'EXISTS'
[L:  1, P: 27]      |            whitespace:                                       ' '
[L:  1, P: 28]      |            table_reference:
[L:  1, P: 28]      |                naked_identifier:                             'test'
[L:  1, P: 32]      |                dot:                                          '.'
[L:  1, P: 33]      |                naked_identifier:                             'transactions_all'
[L:  1, P: 49]      |            whitespace:                                       ' '
[L:  1, P: 50]      |            bracketed:
[L:  1, P: 50]      |                start_bracket:                                '('
[L:  1, P: 51]      |                [META] indent:
[L:  1, P: 51]      |                newline:                                      '\n'
[L:  2, P:  1]      |                whitespace:                                   '    '
[L:  2, P:  5]      |                column_definition:
[L:  2, P:  5]      |                    naked_identifier:                         'transaction_id'
[L:  2, P: 19]      |                    whitespace:                               ' '
[L:  2, P: 20]      |                    data_type:
[L:  2, P: 20]      |                        data_type_identifier:                 'TEXT'
[L:  2, P: 24]      |                comma:                                        ','
[L:  2, P: 25]      |                newline:                                      '\n'
[L:  3, P:  1]      |                whitespace:                                   '    '
[L:  3, P:  5]      |                column_definition:
[L:  3, P:  5]      |                    naked_identifier:                         'transaction_amount'
[L:  3, P: 23]      |                    whitespace:                               ' '
[L:  3, P: 24]      |                    data_type:
[L:  3, P: 24]      |                        data_type_identifier:                 'TEXT'
[L:  3, P: 28]      |                newline:                                      '\n'
[L:  4, P:  1]      |                [META] dedent:
[L:  4, P:  1]      |                end_bracket:                                  ')'
[L:  4, P:  2]      |    statement_terminator:                                     ';'
[L:  4, P:  3]      |    newline:                                                  '\n'
[L:  5, P:  1]      |    newline:                                                  '\n'
[L:  6, P:  1]      |    statement:
[L:  6, P:  1]      |        copy_into_table_statement:
[L:  6, P:  1]      |            keyword:                                          'COPY'
[L:  6, P:  5]      |            whitespace:                                       ' '
[L:  6, P:  6]      |            keyword:                                          'INTO'
[L:  6, P: 10]      |            whitespace:                                       ' '
[L:  6, P: 11]      |            table_reference:
[L:  6, P: 11]      |                naked_identifier:                             'test'
[L:  6, P: 15]      |                dot:                                          '.'
[L:  6, P: 16]      |                naked_identifier:                             'transactions_all'
[L:  6, P: 32]      |            newline:                                          '\n'
[L:  7, P:  1]      |            keyword:                                          'FROM'
[L:  7, P:  5]      |            whitespace:                                       ' '
[L:  7, P:  6]      |            storage_location:
[L:  7, P:  6]      |                stage_path:                                   '@rawdata.STITCH_STAGE_NETSUITE/transactions/'
[L:  7, P: 50]      |            newline:                                          '\n'
[L:  8, P:  1]      |            keyword:                                          'FILE_FORMAT'
[L:  8, P: 12]      |            whitespace:                                       ' '
[L:  8, P: 13]      |            comparison_operator:
[L:  8, P: 13]      |                raw_comparison_operator:                      '='
[L:  8, P: 14]      |            whitespace:                                       ' '
[L:  8, P: 15]      |            file_format_segment:
[L:  8, P: 15]      |                object_reference:
[L:  8, P: 15]      |                    naked_identifier:                         'rawdata'
[L:  8, P: 22]      |                    dot:                                      '.'
[L:  8, P: 23]      |                    naked_identifier:                         'json_format'
[L:  8, P: 34]      |            newline:                                          '\n'
[L:  9, P:  1]      |            keyword:                                          'MATCH_BY_COLUMN_NAME'
[L:  9, P: 21]      |            whitespace:                                       ' '
[L:  9, P: 22]      |            comparison_operator:
[L:  9, P: 22]      |                raw_comparison_operator:                      '='
[L:  9, P: 23]      |            whitespace:                                       ' '
[L:  9, P: 24]      |            keyword:                                          'CASE_INSENSITIVE'
[L:  9, P: 40]      |    statement_terminator:                                     ';'
[L:  9, P: 41]      |    [META] end_of_file:
```

### How to reproduce

Run sqlfluff parse (or lint/fix) on the above code

### Dialect

Snowflake

### Version

sqlfluff, version 3.2.4

### Configuration
```
[sqlfluff]
dialect = snowflake
templater = python
# Allow us to lint even very large files
large_file_skip_byte_limit = 0

# Our included rules
rules = AL01, AL02, AL03, AL04, AL05, AL07, AL08, AL09, AM01, AM02, AM05, AM06, CP01, CP02, CP03,
    CP04, CP05, CV03, CV05, JJ01, LT01, LT02, LT04, LT05, LT06, LT07, LT09, LT10, RF01, RF02, ST02, ST03
# Rules that we'd like to warn rather than error
warnings = RF01, RF02, LT02, LT05
max_line_length = 120

[sqlfluff:indentation]
indented_joins = True
allow_implicit_indents = True
indented_on_contents = False

[sqlfluff:rules:aliasing.forbid]
# Forbids aliases unless it is a self join
force_enable = True

[sqlfluff:rules:ambiguous.column_references]
# makes it so you can't group by/order by 1,2,3 etc.
group_by_and_order_by_style = explicit

[sqlfluff:rules:layout.select_targets]
# This enforces that the * be on a new line for a query such as "SELECT * FROM foo"
wildcard_policy = multiple

[sqlfluff:layout:type:comma]
# This does trailing vs. leading commas
line_position = trailing
```
### Are you willing to work on and submit a PR to address the issue?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/sqlfluff/sqlfluff/blob/main/CODE_OF_CONDUCT.md)



Functions to edit:
src/sqlfluff/dialects/dialect_snowflake.py:CopyOptionsSegment

Patch:
diff --git a/src/sqlfluff/dialects/dialect_snowflake.py b/src/sqlfluff/dialects/dialect_snowflake.py
index dd971228ff0..8058a559d52 100644
--- a/src/sqlfluff/dialects/dialect_snowflake.py
+++ b/src/sqlfluff/dialects/dialect_snowflake.py
@@ -4054,7 +4054,12 @@ class CopyOptionsSegment(BaseSegment):
         Sequence(
             "MATCH_BY_COLUMN_NAME",
             Ref("EqualsSegment"),
-            OneOf("CASE_SENSITIVE", "CASE_INSENSITIVE", "NONE"),
+            OneOf(
+                "CASE_SENSITIVE",
+                "CASE_INSENSITIVE",
+                "NONE",
+                Ref("QuotedLiteralSegment"),
+            ),
         ),
         Sequence(
             "INCLUDE_METADATA",

Test patch: diff --git a/test/fixtures/dialects/snowflake/copy_into_table.sql b/test/fixtures/dialects/snowflake/copy_into_table.sql
index d550ba66923..8435bfc3c6a 100644
--- a/test/fixtures/dialects/snowflake/copy_into_table.sql
+++ b/test/fixtures/dialects/snowflake/copy_into_table.sql
@@ -81,3 +81,8 @@ MATCH_BY_COLUMN_NAME = CASE_INSENSITIVE
 FILE_FORMAT = (TYPE = JSON)
 INCLUDE_METADATA = (
     ingestdate = METADATA$START_SCAN_TIME, filename = METADATA$FILENAME);
+
+COPY INTO test.transactions_all
+FROM @rawdata.STITCH_STAGE_NETSUITE/transactions/
+FILE_FORMAT = rawdata.json_format
+MATCH_BY_COLUMN_NAME = 'case_insensitive';
diff --git a/test/fixtures/dialects/snowflake/copy_into_table.yml b/test/fixtures/dialects/snowflake/copy_into_table.yml
index 9a3fa8c4609..9318a3202dd 100644
--- a/test/fixtures/dialects/snowflake/copy_into_table.yml
+++ b/test/fixtures/dialects/snowflake/copy_into_table.yml
@@ -3,7 +3,7 @@
 # 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: c66235d23458e18428aca8c525fb3575b4c9fac1fe207f2008f4b9dea6b251b3
+_hash: 040e7069446054b29b50495660eaf946f067ce1ef76fdbdb0654ff313f51fb2b
 file:
 - statement:
     copy_into_table_statement:
@@ -464,3 +464,27 @@ file:
       - keyword: METADATA$FILENAME
       - end_bracket: )
 - statement_terminator: ;
+- statement:
+    copy_into_table_statement:
+    - keyword: COPY
+    - keyword: INTO
+    - table_reference:
+      - naked_identifier: test
+      - dot: .
+      - naked_identifier: transactions_all
+    - keyword: FROM
+    - storage_location:
+        stage_path: '@rawdata.STITCH_STAGE_NETSUITE/transactions/'
+    - keyword: FILE_FORMAT
+    - comparison_operator:
+        raw_comparison_operator: '='
+    - file_format_segment:
+        object_reference:
+        - naked_identifier: rawdata
+        - dot: .
+        - naked_identifier: json_format
+    - keyword: MATCH_BY_COLUMN_NAME
+    - comparison_operator:
+        raw_comparison_operator: '='
+    - quoted_literal: "'case_insensitive'"
+- statement_terminator: ;