> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamnative.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect with a PostgreSQL Client

> Connect a PostgreSQL-compatible client to a SQL Workspace native endpoint.

Use the native PostgreSQL endpoint to query a SQL Workspace. This guide uses `psql` as an example, but you can use any PostgreSQL-compatible client.

## Before you begin

You need:

* A **Ready** SQL Workspace and SQL Catalog.
* The native PostgreSQL hostname published for the workspace.
* A SQL username and password.
* A PostgreSQL-compatible client that supports TLS and hostname verification.

## Get the connection details

1. In the Cloud Console, click **SQL** and open the SQL Workspace.
2. Open the workspace **Settings** page.
3. Copy the native PostgreSQL hostname. Do not derive or guess the hostname.
4. Record the target database and username, and obtain the password through the approved credential workflow.

<Frame caption="Copy the native PostgreSQL endpoint for a SQL Workspace.">
  <img src="https://mintcdn.com/streamnative/rWIjiXpwX0pKVnS4/media/sql-workspace-native-endpoint.png?fit=max&auto=format&n=rWIjiXpwX0pKVnS4&q=85&s=cc74db1e0b6abcd039a2ba9d6c64cc86" alt="Native PostgreSQL endpoint on the SQL Workspace Settings page" width="4640" height="2418" data-path="media/sql-workspace-native-endpoint.png" />
</Frame>

## Connection settings

| Field | Value |
| - | - |
| Host | The native PostgreSQL hostname published for the SQL Workspace |
| Port | `4567` |
| Database | The database created for the target SQL Catalog |
| Username | Your SQL Workspace engine username |
| Password | The password for your SQL Workspace engine identity |
| TLS mode | A certificate- and hostname-verifying mode, such as `verify-full` |

## Connect with psql

Run the following command. Omit the password so that `psql` prompts for it securely:

```bash theme={null}
psql "postgresql://<username>@<native-host>:4567/<database>?sslmode=verify-full"
```

Do not put the password in the URI, shell history, application logs, or screenshots.

After connecting, inspect the session:

```text theme={null}
\conninfo
```

```sql theme={null}
SELECT current_database(), current_user, now();
```

## Verify CRUD operations

Use a uniquely named test table so that you do not affect an existing object:

```sql theme={null}
CREATE TABLE sqlworkspace_crud_test (
  id INTEGER PRIMARY KEY,
  note VARCHAR
);

INSERT INTO sqlworkspace_crud_test VALUES (1, 'created');
SELECT * FROM sqlworkspace_crud_test;

UPDATE sqlworkspace_crud_test
SET note = 'updated'
WHERE id = 1;

DELETE FROM sqlworkspace_crud_test
WHERE id = 1;

DROP TABLE sqlworkspace_crud_test;
```

Creating or deleting engine objects requires the corresponding engine privileges. During Private Preview, Organization Admin users can administer the engine.

## Use another PostgreSQL-compatible client

Clients such as DBeaver, DataGrip, pgAdmin, JDBC applications, and `psycopg` use the same connection fields. Configure the published host, port `4567`, database, username, password, and certificate-verifying TLS mode.

PostgreSQL wire compatibility does not mean that every PostgreSQL server feature is available. See [SQL Workspace engine](/sql/overview/sqlworkspace#engine) for the engine-specific SQL model.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.