Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id BFA33101438B for ; Thu, 1 Mar 2012 14:36:36 -0400 (AST) Received: from mail-pz0-f46.google.com ([209.85.210.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S3Ari-0000cd-TF for pgsql-sql@postgresql.org; Thu, 01 Mar 2012 18:36:35 +0000 Received: by dajr28 with SMTP id r28so1036801daj.19 for ; Thu, 01 Mar 2012 10:36:22 -0800 (PST) Received-SPF: pass (google.com: domain of adrian.klaver@gmail.com designates 10.68.240.135 as permitted sender) client-ip=10.68.240.135; Authentication-Results: mr.google.com; spf=pass (google.com: domain of adrian.klaver@gmail.com designates 10.68.240.135 as permitted sender) smtp.mail=adrian.klaver@gmail.com; dkim=pass header.i=adrian.klaver@gmail.com Received: from mr.google.com ([10.68.240.135]) by 10.68.240.135 with SMTP id wa7mr5924099pbc.7.1330626982350 (num_hops = 1); Thu, 01 Mar 2012 10:36:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=PRxWf0L2RDp1lIQxcWXHyH43/LAKNjNjfnNikdLG8Ak=; b=dc2TbGC4fj6yCes/dtU3kzUxkGmxCV1z1lFBvxkuhmGFVOO3k/BxpcUlTaR8T1NuUJ Jn4eSf/HH2xUeNYvT/X42Gk6ljiv5/u5vBdR5DEKd+ezc1ZjXsTOKfxDGlX5rykjGTAK fOOuG3VdWsStbfjJ+HLGQFtDBOikgRce/AqQA= Received: by 10.68.240.135 with SMTP id wa7mr4931214pbc.7.1330626982217; Thu, 01 Mar 2012 10:36:22 -0800 (PST) Received: from [192.168.200.17] ([74.94.73.222]) by mx.google.com with ESMTPS id u10sm2700114pbf.37.2012.03.01.10.36.19 (version=SSLv3 cipher=OTHER); Thu, 01 Mar 2012 10:36:20 -0800 (PST) Message-ID: <4F4FC1A1.6070702@gmail.com> Date: Thu, 01 Mar 2012 10:36:17 -0800 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Carlos Mennens CC: "PostgreSQL (SQL)" Subject: Re: Change Ownership Recursively References: <4F4FA622.70002@affinitas.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201203/13 X-Sequence-Number: 36408 On 03/01/2012 09:04 AM, Carlos Mennens wrote: > On Thu, Mar 1, 2012 at 11:38 AM, Eric Ndengang > wrote: >> Hi >> You can try this command "REASSIGN OWNED BY .... TO ..." like this: >> REASSIGN OWNED BY previous_role TO new_role; >> DROP OWNED previous_role; > > I did as follows: > > iamunix=# \c postgres > SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256) > You are now connected to database "postgres" as user "carlos". You are working on the database 'postgres' not 'iamunix'. REASSIGN works on the current database only. So you just REASSIGNED any objects in postgres. > postgres=# REASSIGN OWNED BY carlos TO lauren; > REASSIGN OWNED > postgres=# DROP OWNED BY carlos; > DROP OWNED > > iamunix=# \d > List of relations > Schema | Name | Type | Owner > --------+------------------+----------+-------- > public | dept | table | carlos > public | dept_id_seq | sequence | carlos > public | employees | table | carlos > public | employees_id_seq | sequence | carlos > public | manager_lookup | view | carlos > public | managers | table | carlos > public | managers_id_seq | sequence | carlos Change into iamunix and do the REASSIGN. > > That didn't work for some reason but mostly because I don't follow the > concept of what's being done. I've now since changed the database role > owner back to Carlos so now 'Carlos' owns both the database and all of > it's tables. Can we start fresh and assume I just got the request to > change the specified database and all of it's tables, sequences, > views,& triggers to Lauren? See above. For future reference including the Postgres version would be helpful. This area ownership/grants/etc has undergone a lot of changes over the various versions. > -- Adrian Klaver adrian.klaver@gmail.com