@@ -1742,9 +1742,9 @@ GRANT UPDATE
1742
1742
1743
1743
<programlisting>
1744
1744
-- admin can view all rows and fields
1745
- postgres=> set role admin;
1745
+ postgres=> set role admin;
1746
1746
SET
1747
- postgres=> table passwd;
1747
+ postgres=> table passwd;
1748
1748
username | pwhash | uid | gid | real_name | home_phone | extra_info | home_dir | shell
1749
1749
----------+--------+-----+-----+-----------+--------------+------------+-------------+-----------
1750
1750
admin | xxx | 0 | 0 | Admin | 111-222-3333 | | /root | /bin/dash
@@ -1753,33 +1753,33 @@ postgres=> table passwd;
1753
1753
(3 rows)
1754
1754
1755
1755
-- Test what Alice is able to do
1756
- postgres=> set role alice;
1756
+ postgres=> set role alice;
1757
1757
SET
1758
- postgres=> table passwd;
1758
+ postgres=> table passwd;
1759
1759
ERROR: 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;
1761
1761
username | real_name | home_phone | extra_info | home_dir | shell
1762
1762
----------+-----------+--------------+------------+-------------+-----------
1763
1763
admin | Admin | 111-222-3333 | | /root | /bin/dash
1764
1764
bob | Bob | 123-456-7890 | | /home/bob | /bin/zsh
1765
1765
alice | Alice | 098-765-4321 | | /home/alice | /bin/zsh
1766
1766
(3 rows)
1767
1767
1768
- postgres=> update passwd set username = 'joe';
1768
+ postgres=> update passwd set username = 'joe';
1769
1769
ERROR: permission denied for relation passwd
1770
1770
-- 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';
1772
1772
UPDATE 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';
1774
1774
UPDATE 0
1775
- postgres=> update passwd set shell = '/bin/xx';
1775
+ postgres=> update passwd set shell = '/bin/xx';
1776
1776
ERROR: new row violates WITH CHECK OPTION for "passwd"
1777
- postgres=> delete from passwd;
1777
+ postgres=> delete from passwd;
1778
1778
ERROR: permission denied for relation passwd
1779
- postgres=> insert into passwd (username) values ('xxx');
1779
+ postgres=> insert into passwd (username) values ('xxx');
1780
1780
ERROR: permission denied for relation passwd
1781
1781
-- Alice can change her own password
1782
- postgres=> update passwd set pwhash = 'abc';
1782
+ postgres=> update passwd set pwhash = 'abc';
1783
1783
UPDATE 1
1784
1784
</programlisting>
1785
1785
0 commit comments