# PostgresDatabaseResource

- Module: [Aspire.Hosting.PostgreSQL](/reference/api/go/aspire.hosting.postgresql.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

A resource that represents a PostgreSQL database. This is a child resource of a `PostgresServerResource`.

## Definition

```go
type PostgresDatabaseResource interface {
    ExpressionValue
    Resource
    ResourceWithConnectionString
    ResourceWithParent
}
```

## Embeds

- `ExpressionValue`
- `Resource`
- `ResourceWithConnectionString`
- `ResourceWithParent`

## Properties

- `ConnectionStringExpression`: `*ReferenceExpression` `get` -- Gets the connection string expression for the Postgres database.
- `DatabaseName`: `string` `get` -- Gets the database name.
- `JdbcConnectionString`: `*ReferenceExpression` `get` -- Gets the JDBC connection string for the PostgreSQL database.
- `Parent`: [`PostgresServerResource`](/reference/api/go/aspire.hosting.postgresql/postgresserverresource.md) `get` -- Gets the parent PostgresSQL container resource.
- `ResourceTypeDisplayName`: `string` `get` -- Gets the ResourceTypeDisplayName property
- `UriExpression`: `*ReferenceExpression` `get` -- Gets the connection URI expression for the PostgreSQL database.

## Methods

- [WithCreationScript](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource/withcreationscript.md) -- `method` -- Defines the SQL script used to create the database.
  ```go
  WithCreationScript(script string) PostgresDatabaseResource
  ```
- [WithPostgresMcp](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource/withpostgresmcp.md) -- `method` -- Adds a Postgres MCP server container and configures it to connect to the database represented by `builder`.
  ```go
  WithPostgresMcp(options ...*WithPostgresMcpOptions) PostgresDatabaseResource
  ```
