# Postgres

SQL DB with:

* Streaming replication
* Schemas
* User-defined objects like operators, data types, and functions
* Nested transactions
* Table inheritance
* Partitioning
* Several unusual data types, like Money, Geometry, IP addresses, JSON, and data ranges.
* Can execute stored procedures in over a dozen programming languages, including Java, Perl, Python, Ruby, and C/C++.

## Types

| **Character Types**                  | **Description**            |
| ------------------------------------ | -------------------------- |
| character varying(*n*), varchar(*n*) | variable-length with limit |
| character(*n*), char(*n*)            | fixed-length, blank padded |
| text, varchar                        | variable unlimited length  |

If you do not specify the n integer for the `varchar` data type, it behaves like the `text` data type. The performance of the `varchar` (without n) and `text` are the same.

## Psql

* `\du` to see users installed
* `\list`: lists all the databases in Postgres
* `\connect`: connect to a specific database
* `\dt`: list the tables in the currently connected database


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://openai.gitbook.io/code-cheatsheets/all/databases/postgres.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
