You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note my postgres user has access to all these schemas. All queries that I'm about to describe work as expected in psql.
Note that foo is actually a foreign server:
select
srvname as name,
srvowner::regrole as owner,
fdwname as wrapper,
srvoptions as options
from pg_foreign_server
join pg_foreign_data_wrapper w on w.oid = srvfdw;
returns:
name | owner | wrapper | options
----------+-------+--------------+------------------------------------------------------------
bar | root | postgres_fdw | {host=myvpn.com,dbname=my_db,port=5432}
Queries work as expected with the partman schema, even autocomplete works fine:
select * from partman.custom_time_partitions;
Hitting Enter, this query succeeds.
Interestingly, if I try the same thing for bar schema, autocomplete still works to auto-complete the table in that schema. Even \d bar.accounts works fine:
\d bar.accounts
Shows:
+--------------------+--------------------------+-----------+-------------+
| Column | Type | Modifiers | FDW Options |
|--------------------+--------------------------+-----------+-------------|
| account_id | text | not null | 8 |
| account_number | text | not null | 8 |
...
However, when I try to run:
select * from bar.accounts
The repl hangs for a couple of minutes and then I get this:
could not connect to server "bar"
DETAIL: could not connect to server: Connection timed out
Is the server running on host "myvpn.com" (10.10.21.182) and accepting
TCP/IP connections on port 5432?
This works w/ psql
Note also that starting pgcli with that db works:
pgcli -h myvpn.com -U root -d bar
All works as expected thereafter
DEBUG LOGGING
Turning on debug logging I see this:
2022-12-31 02:17:29,065 (99983/MainThread) pgcli.pgexecute DEBUG - Trying a pgspecial command. sql: 'select * from bar.accounts'
2022-12-31 02:17:29,065 (99983/MainThread) pgcli.pgexecute DEBUG - Regular sql statement. sql: 'select * from bar.accounts'
2022-12-31 02:19:39,946 (99983/MainThread) pgcli.pgexecute ERROR - sql: 'select * from bar.accounts', error: SqlclientUnableToEstablishSqlconnection('could not connect to server "bar"\nDETAIL: could not connect to server: Connection timed out\n\tIs the server running on host "myvpn.com" (10.10.23.182) and accepting\n\tTCP/IP connections on port 5432?')
2022-12-31 02:19:39,957 (99983/MainThread) pgcli.pgexecute ERROR - traceback: 'Traceback (most recent call last):\n File "/Users/.../pyenv/lib/python3.10/site-packages/pgcli/pgexecute.py", line 373, in run\n yield self.execute_normal_sql(sql) + (sql, True, False)\n File "/Users/.../pyenv/lib/python3.10/site-packages/pgcli/pgexecute.py", line 423, in execute_normal_sql\n cur.execute(split_sql)\n File "/Users/..../pyenv/lib/python3.10/site-packages/pgcli/pgexecute.py", line 69, in execute\n super().execute(*args, **kwargs)\n File "/Users/.../pyenv/lib/python3.10/site-packages/psycopg/cursor.py", line 728, in execute\n raise ex.with_traceback(None)\npsycopg.errors.SqlclientUnableToEstablishSqlconnection: could not connect to server "bar"\nDETAIL: could not connect to server: Connection timed out\n\tIs the server running on host "myvpn.com" (10.10.23.182) and accepting\n\tTCP/IP connections on port 5432?\n'
2022-12-31 02:19:39,958 (99983/MainThread) pgcli.main DEBUG - headers: None
2022-12-31 02:19:39,958 (99983/MainThread) pgcli.main DEBUG - rows: None
2022-12-31 02:19:39,958 (99983/MainThread) pgcli.main DEBUG - status: '\x1b[31mcould not connect to server "bar"\nDETAIL: could not connect to server: Connection timed out\n\tIs the server running on host "myvpn.com" (10.10.23.182) and accepting\n\tTCP/IP connections on port 5432?\x1b[0m'
But, to emphasize, I can reach that domain. Even by just opening another terminal and trying w/ pgcli as mentioned above. I think it's something about proxying the connection. bar.accounts is behind a vpn. So connecting directly with
pgcli -h myvpn.com -U root -d bar
works fine but whatever connection is being tried internally, seems to try to connect with the IP address of the db in the private network.
Your environment
Please provide your OS and version information.
Mac OS 12.1
Description
Summary: Attempting simple query on a foreign server, docs: https://www.postgresql.org/docs/current/catalog-pg-foreign-server.html
Detail:
I have this schema:
Note my postgres user has access to all these schemas. All queries that I'm about to describe work as expected in psql.
Note that
foo
is actually a foreign server:returns:
Queries work as expected with the
partman
schema, even autocomplete works fine:Hitting Enter, this query succeeds.
Interestingly, if I try the same thing for
bar
schema, autocomplete still works to auto-complete the table in that schema. Even\d bar.accounts
works fine:Shows:
However, when I try to run:
The repl hangs for a couple of minutes and then I get this:
This works w/ psql
Note also that starting pgcli with that db works:
All works as expected thereafter
DEBUG LOGGING
Turning on debug logging I see this:
But, to emphasize, I can reach that domain. Even by just opening another terminal and trying w/ pgcli as mentioned above. I think it's something about proxying the connection.
bar.accounts
is behind a vpn. So connecting directly withworks fine but whatever connection is being tried internally, seems to try to connect with the IP address of the db in the private network.
Your environment
Mac OS 12.1
3.5.0
pip freeze
command.The text was updated successfully, but these errors were encountered: