question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect formatting of the DISTINCT ON construct

See original GitHub issue
>>> import mo_sql_parsing
>>> q = "SELECT DISTINCT ON (col) col, col2 FROM test"
>>> mo_sql_parsing.format(mo_sql_parsing.parse(q))
'SELECT DISTINCT ON(col) AS col, col2 FROM test'

AS is invalid part of the DISTINCT ON construct

Checked on PostgreSQL 13

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
klahnakoskicommented, Oct 15, 2021

thank you for pointing this out.

i also think that is a terrible oversight: https://www.geeksforgeeks.org/postgresql-distinct-on-expression/

fixing…

0reactions
become-ironcommented, Oct 16, 2021

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fastest way to PostgreSQL Distinct and Format - Stack Overflow
I have a 3.5 million rows in table acs_objects and I need to retrieve column creation_date with year only format and distinct.
Read more >
Excel unique / distinct values: how to find, filter, select and ...
Select the column of data where you want to highlight unique values. On the Home tab, in the Styles group, click Conditional Formatting...
Read more >
How to Highlight Distinct Values in Google Sheets - MakeUseOf
You can highlight distinct values in Google Sheets in two simple ways. Here's how! Google Sheets Logo Floating over a red background. There ......
Read more >
Problem using DISTINCT in case insensitive SQL Server ...
We are querying the data from Preson.Contact in the AdventureWorks database. All data is setup as mixed case, so we have no duplicates...
Read more >
5 easy ways to extract Unique Distinct Values - Get Digital Help
Type the Conditional Formatting formula in "Format values where this is true:". Press with left mouse button on "Format..." button.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found