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

Infinite loop generating newlines with semicolon and newline in the query #105

Open
v-from-meiro opened this issue Aug 15, 2018 · 2 comments

Comments

@v-from-meiro
Copy link

Hello there!

I was working on a query and using textql (by the way, great job, thanks for this!) and noticed funny thing.

Usually the command I am using looks like this:

textql -header -output-header -sql "select distinct ex_account_id as account_id , substr( end_time ,1,10) as date , group_concat(case when name ='page_views_total' and period ='day' then value end) as page_views , group_concat(case when name ='page_fan_adds' and period ='day' then value end) as page_fan_adds , group_concat(case when name ='page_fan_removes' and period ='day' then value end) as page_fan_removes , group_concat(case when name ='page_impressions_unique' and period ='day' then value end) as page_reach , group_concat(case when name ='page_fans' and period ='lifetime' then value end) as page_fans from page_insights as pi group by ex_account_id , date " page_insights.csv

Now when you run it is all OK. But check what happens when you put semicolon followed by newline in the end of the query:

textql -header -output-header -sql "select distinct ex_account_id as account_id , substr( end_time ,1,10) as date , group_concat(case when name ='page_views_total' and period ='day' then value end) as page_views , group_concat(case when name ='page_fan_adds' and period ='day' then value end) as page_fan_adds , group_concat(case when name ='page_fan_removes' and period ='day' then value end) as page_fan_removes , group_concat(case when name ='page_impressions_unique' and period ='day' then value end) as page_reach , group_concat(case when name ='page_fans' and period ='lifetime' then value end) as page_fans from page_insights as pi group by ex_account_id , date; " page_insights.csv

When you run it, textql gets probably into an infinite loop and starts to generate a bunch of newlines in the end of an actual result. I ran this without knowing on a server an it crashed in few minutes because of disk space :-D

Let me know if it is just me or you too have this problem :)

Thanks and have a great day!

@v-from-meiro
Copy link
Author

I just noticed it removed the newline after the semicolon in the second query. So, please, add a newline just after the semicolon in a second query to reproduce the error.

@manveru
Copy link

manveru commented Jan 21, 2021

Just wanted to say thanks, stumbled over this issue today as well.

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