Snowflake, Postgres: Parse failure on concatention operator `||`
See original GitHub issueSearch before asking
- I searched the issues and found no similar issues.
What Happened
Concatenate operand ||
incorrectly parsed as two pipes. Both Snowflake and Postgres recognize ||
as concatenation operand, thus 'a' || 'b' -- => 'ab'
. SQLFluff blames it’s incorrect syntax.
Expected Behaviour
'a' || 'b'
should pass linting
Observed Behaviour
'a' || 'b'
fails linting with:
Expected single whitespace between pipe ‘|’ and pipe ‘|’.
How to reproduce
echo “SELECT ‘a’ || ‘b’ AS c;” | sqlfluff lint --dialect postgres --disable-progress-bar - echo “SELECT ‘a’ || ‘b’ AS c;” | sqlfluff lint --dialect snowflake --disable-progress-bar -
Dialect
Snowflake Postgres
Version
sqlfluff, version 1.4.3 Python 3.10.9
Configuration
[sqlfluff] templater = jinja
Are you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
CONCAT , || — Snowflake Documentation
Concatenates one or more strings, or concatenates one or more binary values. If any of the values is null, the result is also...
Read more >COPY TEXT array from Postgres to Snowflake - Stack Overflow
I am using Snowflake Python connector and it complains that "JSON parsing error". Any workaround this?
Read more >PostgreSQL Cast Function 101: How to Convert One Data ...
The PostgreSQL CAST operator enables you to accomplish this. ... PostgreSQL Cast With Concatenation; PostgreSQL Cast String to Boolean ...
Read more >From Postgres to Snowflake - Towards Data Science
It was a migration of ETL scripts from PostgreSQL to Snowflake. ... In other words, Snowflake won't give any error but everything will...
Read more >15: 9.13. Text Search Functions and Operators - PostgreSQL
Returns the number of lexemes plus operators in the tsquery . ... The results are then concatenated in document order to produce the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
SQLFluff 1.4.4 has been released with this fixed in it.
Apologies!
FYI adding this to your config fixes it:
We’re adding it to the default config in #4168 and releasing another fix tonight, but if you can’t wait then apply above addition to your config.