This is a misunderstanding. You are logging into two different databases.
When running
$ psql postgres
postgres
is the name of the database. With default configuration the name of the database user is derived from the name of the system user using ident
authentication automatically. The only parameter is assumed to be the database name. You do not want to change anything in the database postgres
, it's a system database for maintenance tasks.
The other database is named student
. Each database has a schema public
with its respective owner.
Read the manual for psql or try a lowly man psql
.
To transfer ownership of the schema public
in the database student
, log in as superuser:
psql -U postgres student
Or as operating system user postgres
, just:
psql student
And run:
ALTER SCHEMA public OWNER TO student;
Details in the manual once more.