10 Aralık 2019 Salı

CREATE ROLE

Giriş
Kullanıcı bilgilerini değiştirmek için ALTER ROLE kullanılır.

CREATE ROLE ve CREATE USER Farkı Nedir?
Açıklaması şöyle.
In PostgreSQL 9.4 documentation it says: "CREATE USER is now an alias for CREATE ROLE. The only difference is that when the command is spelled CREATE USER, LOGIN is assumed by default, whereas NOLOGIN is assumed when the command is spelled CREATE ROLE."
Açıklaması şöyle. Yani NOLOGIN kullanıcıları grup policy gibi düşünmek gerekir.
According to the description the LOGIN/NOLOGIN attribute determines whether or not a role can be used to connect from a client. A client can be anything from your pgAdmin III to lets say a web application. To test this you might want to create a role with LOGIN attribute and use it instead of your postgres role to connect to your server via pdAdmin III.

A role with NOLOGIN attribute can't do this. This type of role can be regarded as an object you can add privileges to. LOGIN roles might then inherit those privileges by adding them as a member. One can think of the whole matter in terms of groups and users being members of groups.

So after all I think this is just another way of expressing what you already said.
Örnek
felix isminde yeni kullanıcı yaratmak için şöyle yaparız.
CREATE ROLE felix;
Örnek
emp4 isminde yeni kullanıcı yaratmak için şöyle yaparız.
CREATE ROLE emp4 WITH LOGIN PASSWORD 'password';
Örnek
felix isminde ve şifresi süreli yeni kullanıcı yaratmak için şöyle yaparız.
CREATE ROLE felix WITH LOGIN PASSWORD 'password' VALID UNTIL '2020-09-30';

Data Type Formatting Functions - TO_DATE

Giriş
Açıklaması şöyle. Yani bir tipi String'e çevirir, veya String'den parse eder.
The PostgreSQL formatting functions provide a powerful set of tools for converting various data types (date/time, integer, floating point, numeric) to formatted strings and for converting from formatted strings to specific data types.
Formatlama için kullanılan metodlar şöyle
to_char(...),to_date(...),to_number(...),to_timestamp(...)
Örnek
Şöyle yaparız.
to_char(to_date(proforma_invoice_date, 'DD/MM/YYYY')), 'Month')