Don't try to duplicate sets of rights like this, it'll become a management nightmare. Use roles and inheritance.
Instead, create a
ROLE (group) and make both users members of the role. Grant the role the required rights and ownership of any required objects, and the users will automatically inherit those access rights.
To make the transition, either:
Turn the existing user into the shared role by renaming it and dropping its
LOGIN right, turning it from a login role (user) into a non-login role (group), then make a new user with the original name; or
GRANT the new role all the required rights, using
GRANT ... ON DATABASE,
GRANT ... ON SCHEMA,
GRANT ... ON ALL TABLES IN SCHEMA, etc.
Here's a demo of the 1st approach. Say we have an original user named
test with ownership of a table and some other grants:
regress=# CREATE USER test WITH PASSWORD 'original user pw';
regress=# CREATE TABLE testtab(x integer);
regress=# ALTER TABLE testtab OWNER TO test;
We can convert it to a shared role and make a new user with the same name:
regress=# ALTER ROLE test RENAME TO test_group;
NOTICE: MD5 password cleared because of role rename
regress=# ALTER ROLE test_group NOLOGIN;
regress=# CREATE USER test IN GROUP test_group PASSWORD 'original user pw';
So long as you set the same password, the user won't notice the difference.
You can now create a new user and add it to the same role, giving it the same access that the original
test user had before you turned it into the role
test_group. In this case I'm using the separate steps of creating a user then granting them role membership; the effect is the same as the above, I'm just showing you two different ways to do it:
regress=# CREATE USER newuser PASSWORD 'fred';
regress=# GRANT test_group TO newuser;
SELECT * FROM testtab even though
testtab was owned by the user
test and had no
GRANTs to allow other users to access it.