postgresqldata-integritytable-plus

Unsure why psql says table is empty but tableplus returns rows


What am I missing?

screenshot of both results

I've connected on console to a DB I have populated with data, using a socket connection. I've validated that the table in question has the rows I expect. When I try and run a SELECT statement in psql the response comes back with a summary of the table columns and "(0 rows)" but when I query the table in any other tool (rails console, TablePlus) I see all of the data I expect. TablePlus/rails are also configured to connect via socket. I've made sure to log in to the same user account for all three.

Here is how I am connecting via psql: psql connection info

And here is my Tableplus connection setup:

TablePlus connection info


Solution

  • Ok, thanks very much to Frank Heikens' answer above, I eventually noticed that Tableplus doesn't explicitly clarify how it's connected by default, and it lists 127.0.0.1 as the connection it is using rather than a socket address. I tried adding -h 127.0.0.1 in the console when connecting with psql and was indeed able to view the data I expected. It looks like I forgot that I installed Postgres locally way back and then later migrated to connecting to a docker instance, apparently via a network connection rather than a socket file shared to my hard drive like I had thought.

    So, to sumamrize: I was indeed connecting to different DBs. In the first case using psql I was connecting to a Postgres instance running natively on Ubuntu, and with TablePlus/ruby on rails connecting to a Docker Postgres instance via local networking.