Thread: Unusual psql behavior
Postgres 9.4.4. I am seeing something I cannot figure out when using psql. This is what I see: psql (9.4.4) Type "help" for help. production_5432=> select from cell_per ; -- (56 rows) This is when I am logged in as system user aklaver. If I log in as another user on the same machine I see the query results. I see no differences in the user environments that would account for this. Also if I log in as system user aklaver but do psql -d production -U aklaver -n I can see the results. So it seems to be some interaction between readline and whatever code supplies the actual query results. Not sure where to go from here. Thanks, -- Adrian Klaver adrian.klaver@aklaver.com
Adrian Klaver <adrian.klaver@aklaver.com> writes: > I am seeing something I cannot figure out when using psql. > This is what I see: > psql (9.4.4) > Type "help" for help. > production_5432=> select from cell_per ; > -- > (56 rows) I believe this is the expected output for a table with 56 rows and zero columns. (It's probably a bug that psql doesn't display that as 56 empty lines, but nobody's cared enough to fix it.) Since you did not include anything in "select", you've got a zero-column result table. > This is when I am logged in as system user aklaver. If I log in as > another user on the same machine I see the query results. I see no > differences in the user environments that would account for this. You didn't say what query results you expected to get, but it's hard to see how you get anything but zero columns from this query. regards, tom lane
On 08/27/2015 01:38 PM, Tom Lane wrote: > Adrian Klaver <adrian.klaver@aklaver.com> writes: >> I am seeing something I cannot figure out when using psql. > >> This is what I see: > >> psql (9.4.4) >> Type "help" for help. > >> production_5432=> select from cell_per ; >> -- >> (56 rows) > > I believe this is the expected output for a table with 56 rows and zero > columns. (It's probably a bug that psql doesn't display that as 56 > empty lines, but nobody's cared enough to fix it.) Since you did not > include anything in "select", you've got a zero-column result table. > >> This is when I am logged in as system user aklaver. If I log in as >> another user on the same machine I see the query results. I see no >> differences in the user environments that would account for this. > > You didn't say what query results you expected to get, but it's hard > to see how you get anything but zero columns from this query. Correct. Turns out I was using the above query as aklaver and kept on going back to it in history with out thinking. When I logged in as other users I added the *, so select * from cell_per. In the no readline version I was forced to re-enter the query and did the 'right' thing. Just not paying attention, thanks for the heads up. > > regards, tom lane > -- Adrian Klaver adrian.klaver@aklaver.com