N
Neon2y ago
wise-white

How to list tables in the SQL Editor?

When trying to use \dt I get the error ERROR: syntax error at or near "\" (SQLSTATE 42601) . What command can I use to list the tables in the DB?
5 Replies
fair-rose
fair-rose2y ago
\dt is a psql feature, rather than a proper postgres feature. For now you can use SELECT * FROM pg_catalog.pg_tables; There was some interest internally about supporting these psql terms in the editor so I'll put in a word for you!
deep-jade
deep-jade2y ago
Indeed! I’m working on this feature at the moment. I hope we’ll be able to launch support for these backslash commands early in the new year. The tricky bit was porting them from C to JS, which is done: https://github.com/neondatabase/psql-describe
GitHub
GitHub - neondatabase/psql-describe: psql's \d (describe) family of...
psql's \d (describe) family of commands ported to JavaScript - GitHub - neondatabase/psql-describe: psql's \d (describe) family of commands ported to JavaScript
extended-salmon
extended-salmon2y ago
i had the same issue i want to delete a user from table user but my DELETE FROM user WHERE name ="x" doesnt work, any recommend? thnaks!
fair-rose
fair-rose2y ago
IIRC user is a keyword so it needs to be quoted. Try DELETE FROM "user" WHERE name = 'x'
extended-salmon
extended-salmon2y ago
OH Thanks a million! It works :amazing:

Did you find this page helpful?