¡Esta es una revisión vieja del documento!
psql -U postgres enter into console with user postgres.
\q exit.
create schema api;
create table api.todos (
id serial primary key,
done boolean not null default false,
task text not null,
due timestamptz
);
insert into api.todos (task) values
('finish tutorial 0'), ('pat self on back');
create role web_anon nologin; grant web_anon to postgres; grant usage on schema api to web_anon; grant select on api.todos to web_anon;
The web_anon role has permission to access things in the api schema, and to read rows in the todos table.
… Other:
create role todo_user nologin; grant todo_user to postgres; grant usage on schema api to todo_user; grant all on api.todos to todo_user; grant usage, select on sequence api.todos_id_seq to todo_user;