2012-03-23 10 views
12

मैं एक भूमिका 'xyz' है कि पहले एक ही नाम 'xyz' के साथ स्कीमा का मालिक था ड्रॉप करने की कोशिश कर रहा हूँ विफल रहता है। मैं नीचे के रूप में स्कीमा स्वामित्व बदल, और सिर्फ मामले में स्वामित्व पुन: असाइन चला (हालांकि सभी तालिकाओं सुपर उपयोगकर्ता शक्ति के साथ किसी दूसरे उपयोगकर्ता के द्वारा बनाया गया था)। इसके अलावा FYI करेंPostgreSQL ड्रॉप भूमिका क्योंकि डिफ़ॉल्ट विशेषाधिकार

drop role xyz; 
ERROR: role "xyz" cannot be dropped because some objects depend on it 
DETAIL: owner of default privileges on new relations belonging to role xyz in schema xyz 

:: तो मैं इन सब चलाएँ:

alter schema xyz owner to postgres; 
reassign owned by xyz to postgres; 
alter default privileges in schema seeds revoke all on tables from xyz cascade; 
alter default privileges in schema seeds revoke all on sequences from xyz cascade; 
alter default privileges in schema seeds revoke all on functions from xyz cascade; 

और फिर भी त्रुटि मिल रही है

postgres=# \du rsi 
List of roles 
Role name | Attributes | Member of 
-----------+----------------+----------- 
rsi  | No inheritance | {} 

मैं क्या याद आ रही है? किसी भी सहायता की सराहना की जाएगी! धन्यवाद!!

+0

ले जाएँ इस dba.stackexchange.com के लिए? –

उत्तर

13

ALTER DEFAULT PRIVILEGES पर PostgreSQL documentation से लिया, नोट्स अनुभाग:

If you wish to drop a role for which the default privileges have been altered, it is necessary to reverse the changes in its default privileges or use DROP OWNED BY to get rid of the default privileges entry for the role.

एक और worthy mention इस मामले में DROP OWNED BY संबंधी दस्तावेज़ों से यह भी कहा कि

Because DROP OWNED only affects the objects in the current database, it is usually necessary to execute this command in each database that contains objects owned by a role that is to be removed.

इसलिए है, अपने लाभ भिन्न हो सकते हैं, जिसका अर्थ है कि आप और अधिक डीबीएस में बयान जारी करने के लिए हो सकता है।

प्रश्न में उल्लिखित वही संदेश प्राप्त करने के बाद, मैंने DROP OWNED BY कथन का प्रयास किया है और यह काम किया है। उम्मीद है की यह मदद करेगा!

+5

'usr द्वारा स्वामित्व ड्रॉप;' 'ड्रॉप उपयोगकर्ता usr द्वारा पीछा किया,' मेरे लिए काम किया, धन्यवाद! – cvsguimaraes