@@ -1742,9 +1742,9 @@ GRANT UPDATE
17421742
17431743<programlisting>
17441744-- admin can view all rows and fields
1745- postgres=> set role admin;
1745+ postgres=> set role admin;
17461746SET
1747- postgres=> table passwd;
1747+ postgres=> table passwd;
17481748 username | pwhash | uid | gid | real_name | home_phone | extra_info | home_dir | shell
17491749----------+--------+-----+-----+-----------+--------------+------------+-------------+-----------
17501750 admin | xxx | 0 | 0 | Admin | 111-222-3333 | | /root | /bin/dash
@@ -1753,33 +1753,33 @@ postgres=> table passwd;
17531753(3 rows)
17541754
17551755-- Test what Alice is able to do
1756- postgres=> set role alice;
1756+ postgres=> set role alice;
17571757SET
1758- postgres=> table passwd;
1758+ postgres=> table passwd;
17591759ERROR: permission denied for relation passwd
1760- postgres=> select username,real_name,home_phone,extra_info,home_dir,shell from passwd;
1760+ postgres=> select username,real_name,home_phone,extra_info,home_dir,shell from passwd;
17611761 username | real_name | home_phone | extra_info | home_dir | shell
17621762----------+-----------+--------------+------------+-------------+-----------
17631763 admin | Admin | 111-222-3333 | | /root | /bin/dash
17641764 bob | Bob | 123-456-7890 | | /home/bob | /bin/zsh
17651765 alice | Alice | 098-765-4321 | | /home/alice | /bin/zsh
17661766(3 rows)
17671767
1768- postgres=> update passwd set username = 'joe';
1768+ postgres=> update passwd set username = 'joe';
17691769ERROR: permission denied for relation passwd
17701770-- Allowed to change her own real_name, but no others
1771- postgres=> update passwd set real_name = 'Alice Doe';
1771+ postgres=> update passwd set real_name = 'Alice Doe';
17721772UPDATE 1
1773- postgres=> update passwd set real_name = 'John Doe' where username = 'admin';
1773+ postgres=> update passwd set real_name = 'John Doe' where username = 'admin';
17741774UPDATE 0
1775- postgres=> update passwd set shell = '/bin/xx';
1775+ postgres=> update passwd set shell = '/bin/xx';
17761776ERROR: new row violates WITH CHECK OPTION for "passwd"
1777- postgres=> delete from passwd;
1777+ postgres=> delete from passwd;
17781778ERROR: permission denied for relation passwd
1779- postgres=> insert into passwd (username) values ('xxx');
1779+ postgres=> insert into passwd (username) values ('xxx');
17801780ERROR: permission denied for relation passwd
17811781-- Alice can change her own password
1782- postgres=> update passwd set pwhash = 'abc';
1782+ postgres=> update passwd set pwhash = 'abc';
17831783UPDATE 1
17841784</programlisting>
17851785
0 commit comments