Skip to content

Commit

Permalink
Added bare functions to values clause
Browse files Browse the repository at this point in the history
  • Loading branch information
WittierDinosaur committed Nov 10, 2021
1 parent 8d7ff64 commit 4f19310
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/sqlfluff/dialects/dialect_ansi.py
Expand Up @@ -1827,6 +1827,7 @@ class ValuesClauseSegment(BaseSegment):
Ref("LiteralGrammar"),
Ref("IntervalExpressionSegment"),
Ref("FunctionSegment"),
Ref("BareFunctionSegment"),
"DEFAULT", # not in `FROM` clause, rule?
ephemeral_name="ValuesClauseElements",
)
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/dialects/postgres/postgres_insert.sql
@@ -1 +1,2 @@
INSERT INTO test (id, col1) OVERRIDING SYSTEM VALUE VALUES (1, 'val');
INSERT INTO foo (bar) VALUES(current_timestamp);
24 changes: 21 additions & 3 deletions test/fixtures/dialects/postgres/postgres_insert.yml
Expand Up @@ -3,9 +3,9 @@
# 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: 0a486da74287f772aad5a317403b1c8a0c67d03e811aa65d29a763a305fe5362
_hash: 563d01a9d3f4d84492323c33e29057117a47da895863eb69e48beccd4bc53a5e
file:
statement:
- statement:
insert_statement:
- keyword: INSERT
- keyword: INTO
Expand All @@ -30,4 +30,22 @@ file:
- comma: ','
- literal: "'val'"
- end_bracket: )
statement_terminator: ;
- statement_terminator: ;
- statement:
insert_statement:
- keyword: INSERT
- keyword: INTO
- table_reference:
identifier: foo
- bracketed:
start_bracket: (
column_reference:
identifier: bar
end_bracket: )
- values_clause:
keyword: VALUES
bracketed:
start_bracket: (
bare_function: current_timestamp
end_bracket: )
- statement_terminator: ;

0 comments on commit 4f19310

Please sign in to comment.