# Generic

> Generic Trino catalogs for any connector Trino supports, including PostgreSQL, with properties taken from Secrets and ConfigMaps.

Trino supports lots of different connectors and we cannot cover all the available connectors. In case the Stackable operator for Trino does not support a specific connector you can use this connector to pull in [any connector Trino supports](https://trino.io/docs/current/connector.html).

This is how you can e.g. use the [PostgreSQL connector](https://trino.io/docs/current/connector/postgresql.html):

## Example generic catalog properties

```yaml
apiVersion: trino.stackable.tech/v1alpha2
kind: TrinoCatalog
metadata:
  # The name of the catalog as it appears in Trino
  name: postgres
  # TrinoCluster can use these labels to select which catalogs to include
  labels:
    trino: simple-trino
spec:
  connector:
    generic:
      connectorName: postgresql
      properties: # optional
        connection-url:
          value: jdbc:postgresql://example.net:5432/database
        connection-user:
          valueFromSecret:
            name: my-postgresql-credentials-secret
            key: user
        connection-password:
          valueFromSecret:
            name: my-postgresql-credentials-secret
            key: password
#         extra-property-from-configmap:
#           valueFromConfigMap:
#             name: my-configmap
#             key: my-key
---
apiVersion: v1
kind: Secret
metadata:
  name: my-postgresql-credentials-secret
stringData:
  user: root
  password: rootroot
```

## Add contents from Secrets or ConfigMaps

In some cases you don’t want to add sensitive data (such as PostgreSQL credentials) to a `TrinoCatalog`. You can then use `valueFromSecret` or `valueFromSecret` to pull in properties securely. An entry must be an valid `SecretKeySelector` or `ConfigMapKeySelector`.

## Add additional contents

In case you need more contents, such as the need to mount Secrets — containing e.g. certificates or keytabs — refer to the [documentation on podOverrides](https://docs.stackable.tech/home/stable/concepts/overrides/index.md).

## Troubleshoot

### Capitalized or upper case table names with PostgreSQL / MySQL

If table names are capitalized or upper case in PostgreSQL / MySQL, Trino can list the tables contained in a schema (lower case) but cannot access any data due to the error:

`Table '<catalog>.<schema>.<table>' does not exist io.trino.spi.TrinoException: line 2:6: Table '<catalog>.<schema>.<table>' does not exist`

This is fixed by setting the `case-insensitive-name-matching` connector property which works for both [PostgreSQL connector](https://trino.io/docs/current/connector/postgresql.html#general-configuration-properties) and [MySQL Connector](https://trino.io/docs/current/connector/mysql.html#general-configuration-properties).

This can be added to the generic connector as follows:

```yaml
spec:
  connector:
    generic:
      ...
      properties:
        case-insensitive-name-matching:
          value: "true"
      ...
```
