-
Notifications
You must be signed in to change notification settings - Fork 600
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
Discussion: whether to add new query syntaxes (syntax sugars) #10268
Comments
I think PG-compatible means that "RisingWave can run the pg SQL without high migration cost" and not the reverse. I do not think there are users who want to copy RisingWave's SQL to a PG or other PG-compatible databases. And also, we have supported for many things PG can not do such as |
Pg also claimed to be standard-compatible, but they add many new syntaxes.
risingwave.dev can do this, but I don't think it's necessary. Redshift also claimed to be pg-compatible, but they don't list every details that are incompatible, e.g. https://docs.aws.amazon.com/redshift/latest/dg/r_CONNECT_BY_clause.html is only available in Redshift.
IMO no user will really port some SQL directly from Pg, most of them port their SQL from big data system. Pg-compatibility just make them easy to write SQLs. So the key goal is ease-to-use.
They also need to debug their SQLs interactively. BTW, we've already add our new syntaxes, e.g. SHOW families. |
I'm imagine there's a cognitive problem: If I see a DB claims to be PG-compatible, and then found a new syntax, I may begin to doubt whether the claim is true. BTW, I think this already happened when users meet problems of client libraries..
They are necessary new features. I want to discuss mainly syntax sugars here, which seems both reasonable and not that necessary at the same time. |
FYI: https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL_Standard |
At least |
I think it is just what I say. Users only are confused when they found something is not supported rather than they found some new syntax. |
I'd like to propose more syntax sugars I want to do.
|
I didn't find they official claim to be PG-compatible. They call themselves "Amazon Redshift SQL". I found such a doc "Amazon Redshift and PostgreSQL" which seems good enough. |
Another RW feature which is already documented and not supported by pg :( CREATE TABLE IF NOT EXISTS taxi_trips(
id VARCHAR,
distance DOUBLE PRECISION,
duration DOUBLE PRECISION,
fare STRUCT<
initial_charge DOUBLE PRECISION,
subsequent_charge DOUBLE PRECISION,
surcharge DOUBLE PRECISION,
tolls DOUBLE PRECISION>);
|
(bikeshedding) BTW, |
Yes I know we have new statements and new data types. (we also have I'm not sure whether it's reasonable, but I do have a feeling that query-level syntax sugars are of different nature. |
https://materialize.com/docs/sql/select/#using-query-hints |
|
Thank @xxchan for bringing up this discussion. My personal workflow is to introduce new features based on:
Typically, Features with the lowest priority are those that aren't urgent and are likely to be changed in the future. For example, I used to suggest that we don't need to introduce In my opinion, following Postgres's syntax helps us avoid pitfalls because we trust in the stability of PG's syntaxes. For example, regarding the design of the OVER window, I suggest following PG's syntax instead of inventing something new. However, if necessary, I am open to introducing new syntax to address problems that are uncommon in PG's scenarios. Therefore, if you want to introduce anything new, please explain the necessities, such as:
Furthermore, such a feature should not break PG drivers' compatibility. Because we don't plan to develop our own custom drivers. |
Two previous issues and a meta-discussion issue with 15 replies (now 16 and continue) already say a lot about the nature of the discussion, i.e.:
I support
and a simple vote (voters specify the reason or agree to others' arguments) that can be triggered at most every XXX period with new arguments and the vote last for XXX period.
The above are all with respect to the topic of this issue A vote with concrete arguments from both sides leads to a decision and a second-time motion allows people to change their minds. |
For myself, I am usually willing to play the role of the opponent. A common problem for engineers (especially the smart ones) is trying too hard to avoid "repeat by yourself" (DRY). But when you look at the big picture, this syntactic sugar may have reduced the workload for 5% of users, but created an average of 15s of confusion for the remaining 95%. If that's the case, it's just not worth it. What's more, those 5% of users often don't mind "repeat by yourself". :) Also, super +1 for |
To summarize, the consensus is that
But people have different attitudes (or philosophy?) towards the necessity of syntax sugars (and maybe also usability features like #10151). @TennyZhuang is the most aggressive. He thinks micro inventions/improvements are also worth it. We can do it if it can make our users or ourselves even a little happier. @fuyufjh is the most conservative, He tends to avoid new features unless there are significant benefits. "Any code can be problematic." (So less is better.)
This also confirms to @lmatz 's words
I can imagine further debate like this:
I think such debate can hardly come to an end, but practically I guess this is our future:
I will close this discussion now, but feel free to add some more comments or correct me if I'm wrong. |
New syntaxes have been proposed several times
IIRC until now we haven’t introduced any new query syntaxes/sugars (only some new statements). To avoid bikeshedding, it's time to decide our general attitude/policy about whether and when to add syntax sugars.
Arguments against new syntaxes
We have claimed to be PG-compatible. Users might feel confused if they found we have convenient new syntaxes. We might at least have a doc listing our new syntaxes if we are going to add some.
Our users mainly run long-running MVs instead of ad-hoc queries (unlike Clickhouse/Bigquery/Snowflakes/...), so they can write the SQLs in an editor and it's not that inconvenient and painful.
Besides,
Originally posted by @lmatz in feat: SELECT * EXCEPT [columnA,columnB,...] #9092 (comment)
A technical concern is that adding new syntaxes may break other things unexpectedly, as SQL is complex and not well-designed.
Arguments for new syntaxes
The new syntax is really convenient in some use cases...
Originally posted by @lmatz in Enable having clause to refer to an alias #7506 (comment)
Other points
If we do want to add, what's the criteria to add? (Maybe just case by case arguments)
How much is the proxy goal PG-compatibility valid?
One real problem is that many PG driver libraries don't work with RisingWave now, mostly due to the complexity of system tables. So we don't benefit that much from the PG-ecosystem (at least for now). And IIRC we decided to develop some custom drivers for some libraries.
But I think a familiar (or popular) syntax of course lowers the user's learning burden.
The text was updated successfully, but these errors were encountered: