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

Cannot convert LEFT function from redshift to presto/trino #1733

Closed
pangyifish opened this issue Jun 6, 2023 · 0 comments
Closed

Cannot convert LEFT function from redshift to presto/trino #1733

pangyifish opened this issue Jun 6, 2023 · 0 comments
Assignees

Comments

@pangyifish
Copy link

sql = """
select LEFT(a, 2) from (select '12345' as a)

"""

converted_sql = sqlglot.transpile(sql, read="redshift", write="trino")[0]
print(converted_sql)

output


SELECT LEFT(a, 2) FROM (SELECT '12345' AS a)

trino will throw error: mismatched input 'LEFT'. Expecting: '*', 'ALL', 'DISTINCT', <expression>" when executing the output SQL
https://docs.aws.amazon.com/redshift/latest/dg/r_LEFT.html

@tobymao tobymao self-assigned this Jun 6, 2023
@tobymao tobymao closed this as completed in 6ad00ca Jun 6, 2023
adrianisk pushed a commit to adrianisk/sqlglot that referenced this issue Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants