Skip to content

AZ629: A key of a type that isn't Postgres's own ​

A type's key is a column of one of Postgres's own types: integers, text, uuid. The functions rowstile makes name the key's type where only Postgres's own are found, whatever the search path of the session that applies. So a key of an extension's type (citext), of a domain or of an enum of the app's is refused when applying, with the column and its type: it used to apply, and then every sign-in failed (type "citext" does not exist). Key the table by a column of integers, text or uuid: its own, or one beside it that the table keeps unique.

Reported when the policy is applied (rowstile push, apply, a migration), against the database.

The mistake ​

authz
app role app_user
type user = app.users
type tag = app.tags (name citext)
  owner : user = owner_id
  can view = owner

Fixed ​

authz
app role app_user
type user = app.users
type tag = app.tags (id bigint)
  owner : user = owner_id
  can view = owner