-
Notifications
You must be signed in to change notification settings - Fork 398
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
equivalent to \d of PostgreSQL ? #179
Comments
There's no such shortcut in the repl yet, but you can run introspection queries. To list object types:
To list properties an links of an object type:
For example:
|
It makes sense for us to implement a similar set of commands to PostgreSQL Many PostgreSQL commands allow to specify a pattern to be matched. The pattern rules are a mix of shell file name patterns, regexp, and identifier quoting. Which incidentally means that
To summarize, I would propose to use patterns that are case-insensitive regexps where the presence of a literal |
+1. But how to make it case-sensitive? Upper-case
+1.
-1. I wouldn't do any of that (implicit :: and current module scope) that -- seems overly complex UX. I'd simply match the pattern on fullnames in all modules.
The classic flag for case-insensitive regexp is |
I think I see your point. I didn't take into account that in PostgreSQL the tendency is to have flat structure where everything is basically in the same "module". Whereas in EdgeDB we expect potentially a fair bit of module fragmentation (depending on coding style, of course). So treating
I like |
I think we should support the following commands:
Open question:
|
Another common feature of For example, On the other hand,
Yes, I think we should. |
To the commands I'd add:
Otherwise I agree with the list. One question, though: what are "access methods"? |
Oh, and we want a |
Additionaly, for functions and scalar types it may be useful to add extra flags (similar to function flags in PostgreSQL):
Where aggregate functions are any functions with at least one
|
I'm not sure if it's going to be useful. Not sure we should have a command to list all indexes either. I'd skip them for now. @elprans?
I don't like the idea of separating functions and aggregates. We don't really separate them in our documentation; aggregate is a function with a SET OF parameter. So I'd just stick to |
Listing what constraints are available is useful when you know you need one, but forgot the exact name. It's also useful to know which custom constraints have already been created so you don't blindly duplicate them. Regarding indexes, knowing which things are indexed could be useful when trying to get a sense of what may be impacting a large complex query. Like trying to narrow down where to look first for optimizations. This bit is coming from ORM experience where a priory I don't always know which indexes will be created automatically and which I need to specify manually, so this kind of overview is useful. Regarding aggregates, I can see why now it's not terribly relevant distinction, but it may be useful when we finally have |
OK on indexes & constraints; just need to tweak the output to make sure it's clear if a constraint is abstract or not. Need to also display clear type names / link/property names for non-abstract constraints and indexes. |
Do we really have to follow the |
The only point of using |
I use psql quite often and I have to look them up most of the time, so I don’t think there’s much muscle memory there other than \dt. We can always put a hint into an error message about unrecognized command. I’m for |
Then \l it is :) I like that it's consistent now. |
Add `\d NAME` command to REPL. It is a shortcut for `DESCRIBE OBJECT` where the `NAME` is plain text name of the concept that needs to be described. No backtick name quoting is needed, but it can be used. For example, the following are equivalent: \d O bje`ct \d `O bje``ct` Largely the backticks are optional so that when keywords are used as names no quoting is necessary. For example, describing a user-created type `Commit` could be done like this: \d Commit \d default::Commit \d default::`Commit` Issue: #179
Add `\d NAME` command to REPL. It is a shortcut for `DESCRIBE OBJECT` where the `NAME` is plain text name of the concept that needs to be described. No backtick name quoting is needed, but it can be used. For example, the following are equivalent: \d O bje`ct \d `O bje``ct` Largely the backticks are optional so that when keywords are used as names no quoting is necessary. For example, describing a user-created type `Commit` could be done like this: \d Commit \d default::Commit \d default::`Commit` Issue: #179
Add `\lm [PATTERN]` command for listing modules, optionally filtered by name using the specified regexp pattern. Add `\lmI [PATTERN]` command for case-sensitive pattern matching. Add `\lr [PATTERN]` command for listing roles, also with option to filter by name using regexp. Add `\lrI [PATTERN]` command for case-sensitive pattern matching. The PATTERN is purely regexp, it should not be quoted in any way, but instead will be treated as a raw string for a regexp search. Issue: #179. Co-authored-by: Eduardo Schettino <schettino72@gmail.com>
Add `\lm [PATTERN]` command for listing modules, optionally filtered by name using the specified regexp pattern. Add `\lmI [PATTERN]` command for case-sensitive pattern matching. Add `\lr [PATTERN]` command for listing roles, also with option to filter by name using regexp. Add `\lrI [PATTERN]` command for case-sensitive pattern matching. The PATTERN is purely regexp, it should not be quoted in any way, but instead will be treated as a raw string for a regexp search. Issue: #179. Co-authored-by: Eduardo Schettino <schettino72@gmail.com>
Add `\lT [PATTERN]` command for listing scalar types, optionally filtered by name using the specified regexp pattern. Add `\lTI [PATTERN]` command for case-sensitive pattern matching. Issue #179
Add `\lT [PATTERN]` command for listing scalar types, optionally filtered by name using the specified regexp pattern. Add `\lTI [PATTERN]` command for case-sensitive pattern matching. Issue #179
Add `\lc [PATTERN]` command for listing casts, optionally filtered by affected type names using the specified regexp pattern. Add `\lcI [PATTERN]` command for case-sensitive pattern matching. Add `\lt [PATTERN]` command for listing object types, optionally filtered by name using the specified regexp pattern. Add `\ltI [PATTERN]` command for case-sensitive pattern matching. Issue: #179
Add `\lc [PATTERN]` command for listing casts, optionally filtered by affected type names using the specified regexp pattern. Add `\lcI [PATTERN]` command for case-sensitive pattern matching. Add `\lt [PATTERN]` command for listing object types, optionally filtered by name using the specified regexp pattern. Add `\ltI [PATTERN]` command for case-sensitive pattern matching. Issue: #179
This seems to be done. Feel free to open more specific issues in CLI repository. |
Hi,
with PostgreSQL, we can see the description of a table, is it possible in the REPL?
The text was updated successfully, but these errors were encountered: