Subject: What object types should be in schemas?

From: Peter Eisentraut <[email-masked]>
Date: Wed, 11 Jan 2023 16:32:57 +0100

The current hierarchy of object types is like this:

database
	access method
	event trigger
	extension
	foreign data wrapper
	foreign server
	language
	publication
	schema
		aggregate
		collation
		conversion
		domain
		function/procedure
		index
		operator
		operator class
		operator family
		sequence
		statistics
		table/view
			policy
			rule
			trigger
		text search configuration
		text search dictionary
		text search parser
		text search template
		type
	subscription
role
tablespace

special:
- cast
- transform
- user mapping

How does one decide whether something should be in a schema or not?  The 
current state feels intuitively correct, but I can't determine any firm 
way to decide.

Over in the column encryption thread, the patch proposes to add various 
key types as new object types.  For simplicity, I just stuck them 
directly under database, but I don't know whether that is correct.

Thoughts?

---

From: Alvaro Herrera <[email-masked]>
Date: Thu, 12 Jan 2023 18:41:57 +0100

On 2023-Jan-11, Peter Eisentraut wrote:

> current state feels intuitively correct, but I can't determine any firm way
> to decide.
> 
> Over in the column encryption thread, the patch proposes to add various key
> types as new object types.  For simplicity, I just stuck them directly under
> database, but I don't know whether that is correct.

I think one important criterion to think about is how does encryption work
when you have per-customer (or per-whatever) schemas.  Is the concept of
a column encryption [objtype] a thing that you would like to set up per
customer?  In that case, you will probably want that object to live in
that customer's schema.  Otherwise, you'll force the DBA to come up with
a naming scheme that includes the customer name in the column encryption
object.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"En las profundidades de nuestro inconsciente hay una obsesiva necesidad
de un universo lógico y coherente. Pero el universo real se halla siempre
un paso más allá de la lógica" (Irulan)