try running psql from the container and completing with "select * from [TAB]". It doesn't work for some reason I don't understand. Any ideas?
yes, i had the same problem and i have finally found why.
postgresql-client is built against libedit2 for licensing issue, this is why completion is rather limited as libedit2 doesn't have libreadline6 capabilities.
Andreas Barth have found a workaround for this problem in the pg_wrapper script for Debian, cf :
https://anonscm.debian.org/cgit/pkg-postgresql/postgresql-common.git/commit/?id=6882564a14b74e83a8d7eb37e349bf7494476558
This script is installed already in this docker image, but it is not used as it is not the first in the PATH : https://github.com/docker-library/postgres/blob/master/9.6/Dockerfile#L50
so for a quick solution and for TL;DR you can use /usr/bin/psql instead of just psql and enjoy the completion
Thank you, @vr, this is awesome! @tianon, shouldn't this Docker image set /usr/bin first in PATH?
Yeah, I suppose I'm +1 to explicitly adding "/usr/bin" to the front of that
PATH with a comment explaining why we're doing so (perhaps even pointing
back to this issue).
Maybe it would make more sense to invert the order here:
https://github.com/docker-library/postgres/blob/master/Dockerfile-debian.template#L50
In addition of adding a comment.
Yes, it would be very convenient to be able to use auto completion :
Now I use "docker exec -it my_id /usr/bin/psql" instead of "docker exec -it my_id psql" :(
I build my own image on top of postgresql, and then just including this in the Dockerfile did the trick:
ENV PATH /usr/bin:$PATH
Most helpful comment
yes, i had the same problem and i have finally found why.
postgresql-client is built against libedit2 for licensing issue, this is why completion is rather limited as libedit2 doesn't have libreadline6 capabilities.
Andreas Barth have found a workaround for this problem in the pg_wrapper script for Debian, cf :
https://anonscm.debian.org/cgit/pkg-postgresql/postgresql-common.git/commit/?id=6882564a14b74e83a8d7eb37e349bf7494476558
This script is installed already in this docker image, but it is not used as it is not the first in the PATH : https://github.com/docker-library/postgres/blob/master/9.6/Dockerfile#L50
so for a quick solution and for TL;DR you can use
/usr/bin/psqlinstead of justpsqland enjoy the completion