Open jameshowison opened 2 years ago
Hi @jameshowison, thanks for opening the issue.
Currently xeus-sql
doesn't have a roadmap for implementing something like this.
But in case you or anyone would like to tackle this issue, here are some tips:
%
sign insteadsqlite
on the xeus-sqlite repo, see and it's not too hard to implement the exact same logic hereIf you need any help, feel free to open issues here or contact me on a synchronous way.
Thanks for the guidance. I don't think I can implement that, but I am trying to bring it someone's attention who might be able to.
Just for additional insight, one of the reasons that this is crucial is that one cannot switch databases in xeus-sql, one has to know to reconnect to change databases. That's because that requires the \c
command: https://stackoverflow.com/questions/3949876/how-to-switch-databases-in-psql
The consequence of this is that currently in xeus-sql if you connect and use CREATE DATABASE some_db
then issue a CREATE TABLE some_table
command, the table is actually created in the default database and not in the new database. In my case the default database was created named after the database user. I could only find this out using the commandline client and pgadmin.
So one would have to do:
%LOAD postgresql host=localhost
CREATE DATABASE some_db;
then reconnect to change to that database.
%LOAD postgresql host=localhost dbname=some_db
then create the tables:
CREATE TABLE some_table
I guess once one knows this it's not too bad :)
If SOCI doesn't offer this kind of stuff we can encapsulate this nicely by calling %LOAD postgresql host=localhost dbname=some_db
in our API and some_db
is the %\c
argument.
Thanks for the insights for this one @jameshowison! :)
Postgres uses commands starting with a \ char, but these don't seem to execute in xues-sql. e.g.,
which should show all databases the user can see on the server, but it gives this error:
Same for the commonly used \d and \dt.