14 Mart 2023 Salı

public Schema - Eğer Schema İsmi Belirtilmezse Public Schema Kullanılır

Giriş
Açıklaması şöyle.
If you leave the schema unspecified, Postgres defaults to a schema named public within the database.
public isimli schema her veri tabanında vardır. Açıklaması şöyle
In the previous sections we created tables without specifying any schema names. By default such tables (and other objects) are automatically put into a schema named “public”. Every new database contains such a schema.
public Schema Kirletilmemeli
Açıklaması şöyle
PostgreSQL has support for multiple schemas. We all typically end up using just the public schema for most use cases. But multiple schemas are a nice way to namespace your different application use cases since joining of data and establishing relationships between schemas is fairly easy.
I tend to use schemas for reporting views for analytics and keep my primary table schema (public) noiseless.
public schema ve PostgreSQL 15 İle Değişiklikler
Açıklaması şöyle. public schema'da tablo yaratmak artık herkes için mümkün değil.
Postgres 15 removes the global write privilege from the public schema. For example, if you are using a user which doesn't have superuser privileges, the CREATE statements on public will no longer work.

# this doesn't work anymore
CREATE table author (id integer, name text);


You will get a permission denied error going forward. This is good from a security pov as the public schema is ab(used) for dumping everything but is also exposed on the search_path by default.

Hasura supports read-only Postgres, so you if want to give access to public schema for just reads, it will continue to work as intended.

Hiç yorum yok:

Yorum Gönder