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

Fix broken LIMIT clause in query templates. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lmwnshn
Copy link

@lmwnshn lmwnshn commented Jul 20, 2022

Because qgen is essentially a find-and-replace, it was outputting PostgreSQL SQL like

order by
    l_returnflag, l_linestatus;
limit -1;

order by
    revenue desc;
limit 20;

which has the following problems:

  1. negative limits don't make sense and are unsupported in most DBMSs, e.g., PostgreSQL mailing list thread asking if this was a joke, PostgreSQL commit rejecting negative limits in 2008.
  2. the limit clause is not attached to the select.

I have not tested this behavior with the other DBMSs in tpcd.h, although a number of those seem to be outdated anyway (e.g., SQLSERVER should use TOP instead of rowcount now).

Because qgen is essentially a find-and-replace, it was outputting PostgreSQL SQL like

```
order by
    l_returnflag, l_linestatus;
limit -1;

order by
    revenue desc;
limit 20;
```

which has the following problems:

1. negative limits don't make sense and are unsupported in most DBMSs,
2. the limit clause is not attached to the select.
@LinuzJ
Copy link

LinuzJ commented Jun 28, 2024

Would be nice to merge this to master @gregrahn.

qgen for PostgreSQL is quite useless otherwise, needing a bunch of manual work post generation.

@LinuzJ LinuzJ mentioned this pull request Jun 28, 2024
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

Successfully merging this pull request may close these issues.

2 participants