title: Unable to issue long sql query to postgres pod in kubernetes via bash script
body: <p>I am trying to execute a query on postgres pod in k8s via bash script but cannot get results when i select a large number of columns. Here is my query:</p>
  <pre><code>kubectl exec -it postgres-pod-dcd-wvd -- bash -c &quot;psql -U postgres -c \&quot;Select json_build_object('f_name',json_agg(f_name),'l_name',json_agg(l_name),'email',json_agg(email),'date_joined',json_agg(date_joined),'dep_name',json_agg(dep_name),'address',json_agg(address),'zip_code',json_agg(zip_code),'city',json_agg(city), 'country',json_agg(country)) from accounts WHERE last_name='ABC';\&quot;&quot;
  </code></pre>
  <p>When i reduce the number of columns to be selected in the query, i get the results but if I use all the column names, the query just hangs indefinitely. What could be wrong here?</p>
  <p>Update:</p>
  <p>I tried using the query as :</p>
  <pre><code>kubectl exec -it postgres-pod-dcd-wvd -- bash -c &quot;psql -U postgres -c \&quot;Select last_name,first_name,...(other column names).. row_to_json(accounts) from register_account WHERE last_name='ABC';\&quot;&quot;
  </code></pre>
  <p>But this also hangs.</p>