diff --git a/POSTGRESQL.md b/POSTGRESQL.md index 1bcd18b..36887f7 100644 --- a/POSTGRESQL.md +++ b/POSTGRESQL.md @@ -28,3 +28,26 @@ This section covers connecting to a PostgreSQL database instance. likely that the user do not have the correct privileges on the PostgreSQL database. Database-level permissions (e.g., `SELECT`, `INSERT`) are required to execute queries. + +--- + +# Usage Guidelines + +## Reusing Project Values + +Users may have set project environment variables: + + * `POSTGRES_HOST`: The hostname or IP address of the PostgreSQL server. + * `POSTGRES_PORT`: The port number of the PostgreSQL server. + * `POSTGRES_DATABASE`: The name of the database to connect to. + * `POSTGRES_USER`: The username for authentication. + * `POSTGRES_PASSWORD`: The password for authentication. + +Instead of prompting the user for these values for specific tool calls, prompt the user to verify reuse a specific value. +Make sure to not use the environment variable name like `POSTGRES_HOST`, `${POSTGRES_HOST}`, or `$POSTGRES_HOST`. The value can be found by using command: `echo $POSTGRES_HOST`. + +## Use Full Table Name Format "DATABASE_NAME.SCHEMA_NAME.TABLE_NAME" + +**ALWAYS** use the full table name format, `DATABASE_NAME.SCHEMA_NAME.TABLE_NAME` in the generated SQL when using the `execute_sql` or `postgres__execute_sql` tool. +* Default to using "public" for the schema name. +* Use command `echo $POSTGRES_DATABASE` to get the current database value.