> I was wondering the reason behind this choice. If anyone knows, I'd be happy to hear about it.
Extensions were dumped unconditionally in the beginning, but it was changed to match how procedural language definitions were dumped.
That makes sense. Thank you.
> * it's been overlooked, and we should dump all the extensions available in a schema if this schema has been selected through the --schema flag.
For reference, --schema-only will include all the extensions, but not --schema=foo and not "--schema-only --schema=foo".
Yes.
Extensions don't belong to a schema per se, the namespace oid in pg_extension marks where most of the objects are contained but not necessarily all of them. Given that, it makes sense to not include extensions for --schema. However, that can be considered sort of an implementation detail which may not be entirely obvious to users (especially since you yourself is a power-user).
I agree.
> * it's kind of like the large objects handling, and I'd pretty interested in adding a --extensions (as the same way there is a --blobs flag).
An object in a schema might have attributes that depend on an extension in order to restore, so it makes sense to provide a way to include them for a --schema dump.
That's actually how I figured this out. A customer can't restore his dump because of a missing extension (pg_trgm to be precise).
The question is what --extensions should do: only dump any extensions that objects in the schema depend on; require a pattern and only dump matching extensions; dump all extensions (probably not) or something else?
Actually, "dump all extensions" (#3) would make sense to me, and has my vote. Otherwise, and though it would imply much more work, "only dump any extension that objects in the schema depend on" (#1) comes second in my opinion. Using the pattern means something more manual for users, and I really think it would be a bad idea. People dump databases, schemas, and tables. Theu usually don't know which extensions those objects depend on. But, anyway, I would work on any of these solutions, depending on what most people think is best.