Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing Error : Unable to parse DEFAULT in postgreSQL dialect #849

Closed
SUNNUWORKS opened this issue Mar 10, 2021 · 0 comments · Fixed by #1137
Closed

Parsing Error : Unable to parse DEFAULT in postgreSQL dialect #849

SUNNUWORKS opened this issue Mar 10, 2021 · 0 comments · Fixed by #1137
Labels
bug Something isn't working dialect Issue related to general dialect support. Use dialect-specific label instead where appropriate postgres Issues relating to the Postgres dialect

Comments

@SUNNUWORKS
Copy link

I am using postgreSQL dialect and for the following SQL script, I'am executing linting from sqlfluff, which fails

CREATE TABLE IF NOT EXISTS landing.shift
(
	id VARCHAR(18)  NOT NULL,
	ownerid VARCHAR(18),
	isdeleted BOOLEAN DEFAULT FALSE,
	shiftnumber VARCHAR(765) NOT NULL,
	currencyisocode VARCHAR(9) DEFAULT 'EUR',
	createddate TIMESTAMP,
	createdbyid VARCHAR(18),
	lastmodifieddate TIMESTAMP,
	lastmodifiedbyid VARCHAR(18),
	systemmodstamp TIMESTAMP,
	lastvieweddate TIMESTAMP,
	lastreferenceddate TIMESTAMP,
	label VARCHAR(765),
	starttime TIMESTAMP,
	endtime TIMESTAMP,
	serviceresourceid VARCHAR(18),
	serviceresource_skey INT,
	serviceterritoryid VARCHAR(18),
	serviceterritory_skey INT,
	statuscategory VARCHAR(765),
	"status" VARCHAR(120) DEFAULT 'Tentative',
	timeslottype VARCHAR(765) DEFAULT 'Normal',
	jobprofileid VARCHAR(18),
	recordsetfiltercriteriaid VARCHAR(18),
	etl_timestamp TIMESTAMP DEFAULT GETDATE(),
	CONSTRAINT shift_pkey PRIMARY KEY (shiftnumber)
);

Executing the following command results into failure
sqlfluff lint .\redshift\landingTables\shift.sql
with the following output,

== [.\redshift\landingTables\shift.sql] FAIL
L:   1 | P:   1 |  PRS | Found unparsable section: 'CREATE TABLE IF NOT EXISTS
                       | landing.shift...'

SQL fluff parse output for the same snippet is as follows,

=== [.\redshift\landingTables\shift.sql] ===
FileSegment:                                                [0](1, 1, 1)
    StatementSegment:                                       [0](1, 1, 1)
        UnparsableSegment:                                  [0](1, 1, 1)        !! Expected: 'WITH, ... | SELECT,  !!TODO!! , *, ..., ... | VALUE | VALUES,  ( [SINGLE_QUOTE] | [NUMERIC_LITERAL] | TRUE | FALSE | + | -, NumericLiteralSegment | NULL CommaSegment INTERVAL, NumericLiteralSegment, QuotedLiteralSegment | date_part | QuotedLiteralSegment ) ,  !!TODO!!  | NonSetSelectableGrammar | INSERT, ... |  ( comment | newline | + ) | COMMIT, WORK, AND, NO, CHAIN | ROLLBACK, WorkKeywordSegment, AndKeywordSegment, NoKeywordSegment, ChainKeywordSegment | DROP, TABLE | VIEW, IF, EXISTS, identifier | [DOUBLE_QUOTE], RESTRICT | CASCADE | GRANT, ALL, PRIVILEGES 
| SELECT | UPDATE | INSERT,  ( identifier | [DOUBLE_QUOTE] ) , ON, TABLE, ObjectReferenceSegment | AllKeywordSegment, TABLES, IN, SCHEMA, ObjectReferenceSegment, TO, GROUP | USER | ROLE, ObjectReferenceSegment | PUBLIC, WITH, GrantKeywordSegment, OPTION | REVOKE, 
GrantKeywordSegment, OptionKeywordSegment, FOR, AllKeywordSegment, PrivilegesKeywordSegment | SelectKeywordSegment | UpdateKeywordSegment | InsertKeywordSegment,  ( ObjectReferenceSegment ) , OnKeywordSegment, TableKeywordSegment, ObjectReferenceSegment | AllKeywordSegment, TablesKeywordSegment, InKeywordSegment, SchemaKeywordSegment, ObjectReferenceSegment, FROM, GroupKeywordSegment | UserKeywordSegment | RoleKeywordSegment, ObjectReferenceSegment, RESTRICT | CASCADE | CREATE, OR, REPLACE, TABLE, IF, NOT, EXISTS, identifier | [DOUBLE_QUOTE],  ( SingleIdentifierGrammar, data_type_identifier,  ( bare_function | function_name,  (  <anything>  ) , WITHIN, GROUP,  (  <anything>  )  | IGNORE | RESPECT, NULLS, OVER,  (  <anything>  )  |  ( Expression_A_Grammar )  |  ( WITH, ... | SELECT,  !!TODO!! , *, ..., ... | VALUE | VALUES,  ( [SINGLE_QUOTE] | [NUMERIC_LITERAL] | TRUE | FALSE | + | -, NumericLiteralSegment | NULL CommaSegment INTERVAL, NumericLiteralSegment, QuotedLiteralSegment | date_part | QuotedLiteralSegment ) ,  !!TODO!!  | NonSetSelectableGrammar )  | SelectStatementSegment | LiteralGrammar | IntervalExpressionSegment | ObjectReferenceSegment,  !!TODO!! , ::, DatatypeSegment | CASE, ,  !!TODO!! , ELSE, , ExpressionSegment, , , END | CaseKeywordSegment, ExpressionSegment, ,  !!TODO!! , ElseKeywordSegment, , ExpressionSegment, , , EndKeywordSegment | ExistsKeywordSegment, SelectStatementSegment | + | - | NotKeywordSegment, Expression_A_Grammar,  !!TODO!!  ) ,  (  <anything>  ) ,  !!TODO!!  | CONSTRAINT, ObjectReferenceSegment, UNIQUE,  ( ObjectReferenceSegment )  | PRIMARY, KEY,  ( ObjectReferenceSegment )  | FOREIGN, KeyKeywordSegment,  ( ObjectReferenceSegment ) , REFERENCES, ObjectReferenceSegment,  ( ObjectReferenceSegment )  ) , COMMENT, QuotedLiteralSegment | AS, SelectableGrammar | LIKE, ObjectReferenceSegment | ALTER, TABLE, identifier | [DOUBLE_QUOTE], parameter, =, [SINGLE_QUOTE] | [NUMERIC_LITERAL] | TRUE | FALSE | + | -, NumericLiteralSegment | NULL | NakedIdentifierSegment | ADD | MODIFY, COLUMN, SingleIdentifierGrammar, data_type_identifier,  ( bare_function | function_name,  (  <anything>  ) , WITHIN, GROUP,  (  <anything>  )  | IGNORE | RESPECT, NULLS, OVER,  (  <anything>  )  |  ( Expression_A_Grammar )  |  ( WITH, ... | SELECT,  !!TODO!! , *, ..., ... | VALUE | VALUES,  ( LiteralGrammar CommaSegment INTERVAL, NumericLiteralSegment, QuotedLiteralSegment | date_part | QuotedLiteralSegment ) ,  !!TODO!!  | NonSetSelectableGrammar )  | SelectStatementSegment | LiteralGrammar | IntervalExpressionSegment | ObjectReferenceSegment,  !!TODO!! , ::, DatatypeSegment | CASE, ,  !!TODO!! , ELSE, , ExpressionSegment, , , END | CaseKeywordSegment, ExpressionSegment, ,  !!TODO!! , ElseKeywordSegment, , ExpressionSegment, , , EndKeywordSegment | EXISTS, SelectStatementSegment | + | - | NOT, Expression_A_Grammar,  !!TODO!!  ) ,  (  <anything>  ) , 
 !!TODO!! , FIRST | AFTER, ObjectReferenceSegment |  ( ObjectReferenceSegment )  | CREATE, OR, REPLACE, VIEW, identifier | [DOUBLE_QUOTE],  ( ObjectReferenceSegment ) , AS, WITH, ... | SELECT,  !!TODO!! , *, ..., ... | VALUE | VALUES,  ( [SINGLE_QUOTE] | [NUMERIC_LITERAL] | TRUE | FALSE | + | -, NumericLiteralSegment | NULL CommaSegment INTERVAL, NumericLiteralSegment, QuotedLiteralSegment | date_part | QuotedLiteralSegment ) ,  !!TODO!!  | NonSetSelectableGrammar | DELETE, ... | UPDATE, ... | CREATE, OR, REPLACE, MODEL, IF, NOT, EXISTS, identifier | [DOUBLE_QUOTE], OPTIONS,  ( parameter, =, [SINGLE_QUOTE] | [NUMERIC_LITERAL] | TRUE | FALSE | + | -, NumericLiteralSegment | NULL |  ( QuotedLiteralSegment )  ) , AS, WITH, ... | SELECT,  !!TODO!! , *, ..., ... | VALUE | VALUES,  ( LiteralGrammar CommaSegment INTERVAL, NumericLiteralSegment, QuotedLiteralSegment | date_part | QuotedLiteralSegment ) ,  !!TODO!!  | NonSetSelectableGrammar | DROP, MODEL, IF, EXISTS, identifier | [DOUBLE_QUOTE]'
            code_RawSegment:                                [0](1, 1, 1)        'CREATE'
            whitespace_RawSegment:                          [6](1, 1, 7)        ' '
            code_RawSegment:                                [7](1, 1, 8)        'TABLE'
            whitespace_RawSegment:                          [12](1, 1, 13)      ' '
            code_RawSegment:                                [13](1, 1, 14)      'IF'
            whitespace_RawSegment:                          [15](1, 1, 16)      ' '
            code_RawSegment:                                [16](1, 1, 17)      'NOT'
            whitespace_RawSegment:                          [19](1, 1, 20)      ' '
            code_RawSegment:                                [20](1, 1, 21)      'EXISTS'
            whitespace_RawSegment:                          [26](1, 1, 27)      ' '
            code_RawSegment:                                [27](1, 1, 28)      'landing'
            dot_RawSegment:                                 [34](1, 1, 35)      '.'
            code_RawSegment:                                [35](1, 1, 36)      'shift'
            newline_RawSegment:                             [40](1, 1, 41)      '\n'
            start_bracket_KeywordSegment:                   [41](1, 2, 1)       '('
            newline_RawSegment:                             [42](1, 2, 2)       '\n'
            whitespace_RawSegment:                          [43](1, 3, 1)       '\t'
            code_RawSegment:                                [44](1, 3, 2)       'id'
            whitespace_RawSegment:                          [46](1, 3, 4)       ' '
            code_RawSegment:                                [47](1, 3, 5)       'VARCHAR'
            start_bracket_KeywordSegment:                   [54](1, 3, 12)      '('
            numeric_literal_RawSegment:                     [55](1, 3, 13)      '18'
            end_bracket_KeywordSegment:                     [57](1, 3, 15)      ')'
            whitespace_RawSegment:                          [58](1, 3, 16)      '  '
            code_RawSegment:                                [60](1, 3, 18)      'NOT'
            whitespace_RawSegment:                          [63](1, 3, 21)      ' '
            code_RawSegment:                                [64](1, 3, 22)      'NULL'
            comma_RawSegment:                               [68](1, 3, 26)      ','
            newline_RawSegment:                             [69](1, 3, 27)      '\n'
            whitespace_RawSegment:                          [70](1, 4, 1)       '\t'
            code_RawSegment:                                [71](1, 4, 2)       'ownerid'
            whitespace_RawSegment:                          [78](1, 4, 9)       ' '
            code_RawSegment:                                [79](1, 4, 10)      'VARCHAR'
            start_bracket_KeywordSegment:                   [86](1, 4, 17)      '('
            numeric_literal_RawSegment:                     [87](1, 4, 18)      '18'
            end_bracket_KeywordSegment:                     [89](1, 4, 20)      ')'
            comma_RawSegment:                               [90](1, 4, 21)      ','
            newline_RawSegment:                             [91](1, 4, 22)      '\n'
            whitespace_RawSegment:                          [92](1, 5, 1)       '\t'
            code_RawSegment:                                [93](1, 5, 2)       'isdeleted'
            whitespace_RawSegment:                          [102](1, 5, 11)     ' '
            code_RawSegment:                                [103](1, 5, 12)     'BOOLEAN'
            whitespace_RawSegment:                          [110](1, 5, 19)     ' '
            code_RawSegment:                                [111](1, 5, 20)     'DEFAULT'
            whitespace_RawSegment:                          [118](1, 5, 27)     ' '
            code_RawSegment:                                [119](1, 5, 28)     'FALSE'
            comma_RawSegment:                               [124](1, 5, 33)     ','
            newline_RawSegment:                             [125](1, 5, 34)     '\n'
            whitespace_RawSegment:                          [126](1, 6, 1)      '\t'
            code_RawSegment:                                [127](1, 6, 2)      'shiftnumber'
            whitespace_RawSegment:                          [138](1, 6, 13)     ' '
            code_RawSegment:                                [139](1, 6, 14)     'VARCHAR'
            start_bracket_KeywordSegment:                   [146](1, 6, 21)     '('
            numeric_literal_RawSegment:                     [147](1, 6, 22)     '765'
            end_bracket_KeywordSegment:                     [150](1, 6, 25)     ')'
            whitespace_RawSegment:                          [151](1, 6, 26)     ' '
            code_RawSegment:                                [152](1, 6, 27)     'NOT'
            whitespace_RawSegment:                          [155](1, 6, 30)     ' '
            code_RawSegment:                                [156](1, 6, 31)     'NULL'
            comma_RawSegment:                               [160](1, 6, 35)     ','
            newline_RawSegment:                             [161](1, 6, 36)     '\n'
            whitespace_RawSegment:                          [162](1, 7, 1)      '\t'
            code_RawSegment:                                [163](1, 7, 2)      'currencyisocode'
            whitespace_RawSegment:                          [178](1, 7, 17)     ' '
            code_RawSegment:                                [179](1, 7, 18)     'VARCHAR'
            start_bracket_KeywordSegment:                   [186](1, 7, 25)     '('
            numeric_literal_RawSegment:                     [187](1, 7, 26)     '9'
            end_bracket_KeywordSegment:                     [188](1, 7, 27)     ')'
            whitespace_RawSegment:                          [189](1, 7, 28)     ' '
            code_RawSegment:                                [190](1, 7, 29)     'DEFAULT'
            whitespace_RawSegment:                          [197](1, 7, 36)     ' '
            single_quote_RawSegment:                        [198](1, 7, 37)     "'EUR'"
            comma_RawSegment:                               [203](1, 7, 42)     ','
            newline_RawSegment:                             [204](1, 7, 43)     '\n'
            whitespace_RawSegment:                          [205](1, 8, 1)      '\t'
            code_RawSegment:                                [206](1, 8, 2)      'createddate'
            whitespace_RawSegment:                          [217](1, 8, 13)     ' '
            code_RawSegment:                                [218](1, 8, 14)     'TIMESTAMP'
            comma_RawSegment:                               [227](1, 8, 23)     ','
            newline_RawSegment:                             [228](1, 8, 24)     '\n'
            whitespace_RawSegment:                          [229](1, 9, 1)      '\t'
            code_RawSegment:                                [230](1, 9, 2)      'createdbyid'
            whitespace_RawSegment:                          [241](1, 9, 13)     ' '
            code_RawSegment:                                [242](1, 9, 14)     'VARCHAR'
            start_bracket_KeywordSegment:                   [249](1, 9, 21)     '('
            numeric_literal_RawSegment:                     [250](1, 9, 22)     '18'
            end_bracket_KeywordSegment:                     [252](1, 9, 24)     ')'
            comma_RawSegment:                               [253](1, 9, 25)     ','
            newline_RawSegment:                             [254](1, 9, 26)     '\n'
            whitespace_RawSegment:                          [255](1, 10, 1)     '\t'
            code_RawSegment:                                [256](1, 10, 2)     'lastmodifieddate'
            whitespace_RawSegment:                          [272](1, 10, 18)    ' '
            code_RawSegment:                                [273](1, 10, 19)    'TIMESTAMP'
            comma_RawSegment:                               [282](1, 10, 28)    ','
            newline_RawSegment:                             [283](1, 10, 29)    '\n'
            whitespace_RawSegment:                          [284](1, 11, 1)     '\t'
            code_RawSegment:                                [285](1, 11, 2)     'lastmodifiedbyid'
            whitespace_RawSegment:                          [301](1, 11, 18)    ' '
            code_RawSegment:                                [302](1, 11, 19)    'VARCHAR'
            start_bracket_KeywordSegment:                   [309](1, 11, 26)    '('
            numeric_literal_RawSegment:                     [310](1, 11, 27)    '18'
            end_bracket_KeywordSegment:                     [312](1, 11, 29)    ')'
            comma_RawSegment:                               [313](1, 11, 30)    ','
            newline_RawSegment:                             [314](1, 11, 31)    '\n'
            whitespace_RawSegment:                          [315](1, 12, 1)     '\t'
            code_RawSegment:                                [316](1, 12, 2)     'systemmodstamp'
            whitespace_RawSegment:                          [330](1, 12, 16)    ' '
            code_RawSegment:                                [331](1, 12, 17)    'TIMESTAMP'
            comma_RawSegment:                               [340](1, 12, 26)    ','
            newline_RawSegment:                             [341](1, 12, 27)    '\n'
            whitespace_RawSegment:                          [342](1, 13, 1)     '\t'
            code_RawSegment:                                [343](1, 13, 2)     'lastvieweddate'
            whitespace_RawSegment:                          [357](1, 13, 16)    ' '
            code_RawSegment:                                [358](1, 13, 17)    'TIMESTAMP'
            comma_RawSegment:                               [367](1, 13, 26)    ','
            newline_RawSegment:                             [368](1, 13, 27)    '\n'
            whitespace_RawSegment:                          [369](1, 14, 1)     '\t'
            code_RawSegment:                                [370](1, 14, 2)     'lastreferenceddate'
            whitespace_RawSegment:                          [388](1, 14, 20)    ' '
            code_RawSegment:                                [389](1, 14, 21)    'TIMESTAMP'
            comma_RawSegment:                               [398](1, 14, 30)    ','
            newline_RawSegment:                             [399](1, 14, 31)    '\n'
            whitespace_RawSegment:                          [400](1, 15, 1)     '\t'
            code_RawSegment:                                [401](1, 15, 2)     'label'
            whitespace_RawSegment:                          [406](1, 15, 7)     ' '
            code_RawSegment:                                [407](1, 15, 8)     'VARCHAR'
            start_bracket_KeywordSegment:                   [414](1, 15, 15)    '('
            numeric_literal_RawSegment:                     [415](1, 15, 16)    '765'
            end_bracket_KeywordSegment:                     [418](1, 15, 19)    ')'
            comma_RawSegment:                               [419](1, 15, 20)    ','
            newline_RawSegment:                             [420](1, 15, 21)    '\n'
            whitespace_RawSegment:                          [421](1, 16, 1)     '\t'
            code_RawSegment:                                [422](1, 16, 2)     'starttime'
            whitespace_RawSegment:                          [431](1, 16, 11)    ' '
            code_RawSegment:                                [432](1, 16, 12)    'TIMESTAMP'
            comma_RawSegment:                               [441](1, 16, 21)    ','
            newline_RawSegment:                             [442](1, 16, 22)    '\n'
            whitespace_RawSegment:                          [443](1, 17, 1)     '\t'
            code_RawSegment:                                [444](1, 17, 2)     'endtime'
            whitespace_RawSegment:                          [451](1, 17, 9)     ' '
            code_RawSegment:                                [452](1, 17, 10)    'TIMESTAMP'
            comma_RawSegment:                               [461](1, 17, 19)    ','
            newline_RawSegment:                             [462](1, 17, 20)    '\n'
            whitespace_RawSegment:                          [463](1, 18, 1)     '\t'
            code_RawSegment:                                [464](1, 18, 2)     'serviceresourceid'
            whitespace_RawSegment:                          [481](1, 18, 19)    ' '
            code_RawSegment:                                [482](1, 18, 20)    'VARCHAR'
            start_bracket_KeywordSegment:                   [489](1, 18, 27)    '('
            numeric_literal_RawSegment:                     [490](1, 18, 28)    '18'
            end_bracket_KeywordSegment:                     [492](1, 18, 30)    ')'
            comma_RawSegment:                               [493](1, 18, 31)    ','
            newline_RawSegment:                             [494](1, 18, 32)    '\n'
            whitespace_RawSegment:                          [495](1, 19, 1)     '\t'
            code_RawSegment:                                [496](1, 19, 2)     'serviceresource_skey'
            whitespace_RawSegment:                          [516](1, 19, 22)    ' '
            code_RawSegment:                                [517](1, 19, 23)    'INT'
            comma_RawSegment:                               [520](1, 19, 26)    ','
            newline_RawSegment:                             [521](1, 19, 27)    '\n'
            whitespace_RawSegment:                          [522](1, 20, 1)     '\t'
            code_RawSegment:                                [523](1, 20, 2)     'serviceterritoryid'
            whitespace_RawSegment:                          [541](1, 20, 20)    ' '
            code_RawSegment:                                [542](1, 20, 21)    'VARCHAR'
            start_bracket_KeywordSegment:                   [549](1, 20, 28)    '('
            numeric_literal_RawSegment:                     [550](1, 20, 29)    '18'
            end_bracket_KeywordSegment:                     [552](1, 20, 31)    ')'
            comma_RawSegment:                               [553](1, 20, 32)    ','
            newline_RawSegment:                             [554](1, 20, 33)    '\n'
            whitespace_RawSegment:                          [555](1, 21, 1)     '\t'
            code_RawSegment:                                [556](1, 21, 2)     'serviceterritory_skey'
            whitespace_RawSegment:                          [577](1, 21, 23)    ' '
            code_RawSegment:                                [578](1, 21, 24)    'INT'
            comma_RawSegment:                               [581](1, 21, 27)    ','
            newline_RawSegment:                             [582](1, 21, 28)    '\n'
            whitespace_RawSegment:                          [583](1, 22, 1)     '\t'
            code_RawSegment:                                [584](1, 22, 2)     'statuscategory'
            whitespace_RawSegment:                          [598](1, 22, 16)    ' '
            code_RawSegment:                                [599](1, 22, 17)    'VARCHAR'
            start_bracket_KeywordSegment:                   [606](1, 22, 24)    '('
            numeric_literal_RawSegment:                     [607](1, 22, 25)    '765'
            end_bracket_KeywordSegment:                     [610](1, 22, 28)    ')'
            comma_RawSegment:                               [611](1, 22, 29)    ','
            newline_RawSegment:                             [612](1, 22, 30)    '\n'
            whitespace_RawSegment:                          [613](1, 23, 1)     '\t'
            double_quote_RawSegment:                        [614](1, 23, 2)     '"status"'
            whitespace_RawSegment:                          [622](1, 23, 10)    ' '
            code_RawSegment:                                [623](1, 23, 11)    'VARCHAR'
            start_bracket_KeywordSegment:                   [630](1, 23, 18)    '('
            numeric_literal_RawSegment:                     [631](1, 23, 19)    '120'
            end_bracket_KeywordSegment:                     [634](1, 23, 22)    ')'
            whitespace_RawSegment:                          [635](1, 23, 23)    ' '
            code_RawSegment:                                [636](1, 23, 24)    'DEFAULT'
            whitespace_RawSegment:                          [643](1, 23, 31)    ' '
            single_quote_RawSegment:                        [644](1, 23, 32)    "'Tentative'"
            comma_RawSegment:                               [655](1, 23, 43)    ','
            newline_RawSegment:                             [656](1, 23, 44)    '\n'
            whitespace_RawSegment:                          [657](1, 24, 1)     '\t'
            code_RawSegment:                                [658](1, 24, 2)     'timeslottype'
            whitespace_RawSegment:                          [670](1, 24, 14)    ' '
            code_RawSegment:                                [671](1, 24, 15)    'VARCHAR'
            start_bracket_KeywordSegment:                   [678](1, 24, 22)    '('
            numeric_literal_RawSegment:                     [679](1, 24, 23)    '765'
            end_bracket_KeywordSegment:                     [682](1, 24, 26)    ')'
            whitespace_RawSegment:                          [683](1, 24, 27)    ' '
            code_RawSegment:                                [684](1, 24, 28)    'DEFAULT'
            whitespace_RawSegment:                          [691](1, 24, 35)    ' '
            single_quote_RawSegment:                        [692](1, 24, 36)    "'Normal'"
            comma_RawSegment:                               [700](1, 24, 44)    ','
            newline_RawSegment:                             [701](1, 24, 45)    '\n'
            whitespace_RawSegment:                          [702](1, 25, 1)     '\t'
            code_RawSegment:                                [703](1, 25, 2)     'jobprofileid'
            whitespace_RawSegment:                          [715](1, 25, 14)    ' '
            code_RawSegment:                                [716](1, 25, 15)    'VARCHAR'
            start_bracket_KeywordSegment:                   [723](1, 25, 22)    '('
            numeric_literal_RawSegment:                     [724](1, 25, 23)    '18'
            end_bracket_KeywordSegment:                     [726](1, 25, 25)    ')'
            comma_RawSegment:                               [727](1, 25, 26)    ','
            newline_RawSegment:                             [728](1, 25, 27)    '\n'
            whitespace_RawSegment:                          [729](1, 26, 1)     '\t'
            code_RawSegment:                                [730](1, 26, 2)     'recordsetfiltercriteriaid'
            whitespace_RawSegment:                          [755](1, 26, 27)    ' '
            code_RawSegment:                                [756](1, 26, 28)    'VARCHAR'
            start_bracket_KeywordSegment:                   [763](1, 26, 35)    '('
            numeric_literal_RawSegment:                     [764](1, 26, 36)    '18'
            end_bracket_KeywordSegment:                     [766](1, 26, 38)    ')'
            comma_RawSegment:                               [767](1, 26, 39)    ','
            newline_RawSegment:                             [768](1, 26, 40)    '\n'
            whitespace_RawSegment:                          [769](1, 27, 1)     '\t'
            code_RawSegment:                                [770](1, 27, 2)     'etl_timestamp'
            whitespace_RawSegment:                          [783](1, 27, 15)    ' '
            code_RawSegment:                                [784](1, 27, 16)    'TIMESTAMP'
            whitespace_RawSegment:                          [793](1, 27, 25)    ' '
            code_RawSegment:                                [794](1, 27, 26)    'NULL'
            whitespace_RawSegment:                          [798](1, 27, 30)    ' '
            code_RawSegment:                                [799](1, 27, 31)    'DEFAULT'
            whitespace_RawSegment:                          [806](1, 27, 38)    ' '
            code_RawSegment:                                [807](1, 27, 39)    'GETDATE'
            start_bracket_KeywordSegment:                   [814](1, 27, 46)    '('
            end_bracket_KeywordSegment:                     [815](1, 27, 47)    ')'
            comma_RawSegment:                               [816](1, 27, 48)    ','
            newline_RawSegment:                             [817](1, 27, 49)    '\n'
            whitespace_RawSegment:                          [818](1, 28, 1)     '\t'
            code_RawSegment:                                [819](1, 28, 2)     'CONSTRAINT'
            whitespace_RawSegment:                          [829](1, 28, 12)    ' '
            code_RawSegment:                                [830](1, 28, 13)    'shift_pkey'
            whitespace_RawSegment:                          [840](1, 28, 23)    ' '
            code_RawSegment:                                [841](1, 28, 24)    'PRIMARY'
            whitespace_RawSegment:                          [848](1, 28, 31)    ' '
            code_RawSegment:                                [849](1, 28, 32)    'KEY'
            whitespace_RawSegment:                          [852](1, 28, 35)    ' '
            start_bracket_KeywordSegment:                   [853](1, 28, 36)    '('
            code_RawSegment:                                [854](1, 28, 37)    'shiftnumber'
            end_bracket_KeywordSegment:                     [865](1, 28, 48)    ')'
            newline_RawSegment:                             [866](1, 28, 49)    '\n'
            end_bracket_KeywordSegment:                     [867](1, 29, 1)     ')'
    semicolon_KeywordSegment:                               [868](1, 29, 2)     ';'
    newline_RawSegment:                                     [869](1, 29, 3)     '\n'

==== parsing violations ====
L:   1 | P:   1 |  PRS | Found unparsable section: 'CREATE TABLE IF NOT EXISTS
                       | landing.shift...'

Expected Behaviour

The SQL script should PASS the lining check as it's following postgresql-createtable, which is also documented in SQLFluff.

Observed Behaviour

When removing all the DEFAULT column_comnstraints from the script, the linting will PASS.

Version

sqlfluff --version ---> sqlfluff, version 0.3.6
python version -----> Python 3.8.5

Configuration

[sqlfluff]
verbose = 0
nocolor = False
dialect = postgres
templater = jinja
rules = None
exclude_rules = None
recurse = 0
output_line_length = 80

[sqlfluff:indentation]
indented_joins = True

[sqlfluff:templater:jinja]
apply_dbt_builtins = True

[sqlfluff:templater:jinja:macros]
# Macros provided as builtins for dbt projects
dbt_ref = {% macro ref(model_ref) %}{{model_ref}}{% endmacro %}
dbt_source = {% macro source(source_name, table) %}{{source_name}}_{{table}}{% endmacro %}
dbt_config = {% macro config() %}{% for k in kwargs %}{% endfor %}{% endmacro %}
dbt_var = {% macro var(variable) %}item{% endmacro %}

# Some rules can be configured directly from the config common to other rules.
[sqlfluff:rules]
tab_space_size = 4
max_line_length = 150
indent_unit = space

# Some rules have their own specific config.
[sqlfluff:rules:L010]
capitalisation_policy = consistent

[sqlfluff:rules:L019]
comma_style = trailing

@SUNNUWORKS SUNNUWORKS added the bug Something isn't working label Mar 10, 2021
@barrywhart barrywhart added dialect Issue related to general dialect support. Use dialect-specific label instead where appropriate postgres Issues relating to the Postgres dialect labels Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dialect Issue related to general dialect support. Use dialect-specific label instead where appropriate postgres Issues relating to the Postgres dialect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants