Reputation: 3619
I have a PostgresDB query which I want to run directly using kubectl exec
:
kubectl exec -it -n <ns> <pod_name> -- psql -U <user> -d <db> -c "select * from <table> where id=1234;"
I want to toggle expanded output (\x on
option) only for this command. I do not want to permanently enable this for all queries.
I have tried various things, such as chaining commands together with a semi-colon (i.e. \x on; select * from <table>;
). I'm not getting this to work.
How do I get this to work?
Upvotes: 0
Views: 384
Reputation: 247445
There are several ways to do that, but the simplest is to use the -x
option of psql
.
Upvotes: 2