Here's an ODBC example I use on Rhel 7, pwsh v7.2.1, without any extra modules except for the postgresql-odbc driver:
$conn = New-Object System.Data.Odbc.OdbcConnection
$conn.ConnectionString= "Driver={PostgreSQL};Server=SERVERNAME;Port=1234;Database=DBNAME;Uid=USERNAME;Pwd=PASS;"
$conn.open()
$query = 'SELECT * FROM pg_catalog.pg_tables'
$command = New-Object System.Data.Odbc.OdbcCommand($query,$conn)
# For commands/queries that return rows
$reader = $command.ExecuteReader()
# Optionally, convert reader output to DataTable object for viewing
# I disable constraints on my result table for this query. Otherwise returns "Failed to enable constraints"
$DataSet = New-Object Data.Dataset -Property @{ EnforceConstraints = $false }
$DataTable = New-Object Data.DataTable
$DataSet.Tables.Add($DataTable)
$DataTable.Load($reader,[Data.LoadOption]::OverwriteChanges)
# For Write/Inserts:
$command.ExecuteNonQuery() ## for commands that don't return data e.g. Update
# Cleanup:
$command.Dispose() ## OdbcCommand objects cannot be re-used, so it helps to close them after execution
$conn.Close() ## Connections can be reused, but close it before ending your script.
# displaying results
$DataTable|ft
schemaname tablename tableowner tablespace hasindexes hasrules hastriggers rowsecurity
---------- --------- ---------- ---------- ---------- -------- ----------- -----------
public sys_db_changelog admin01 1 0 0 0
public sys_server admin01 1 0 0 0
public sys_config admin01 1 0 0 0