Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1omMKL-0003Zj-UV for pgsql-general@arkaria.postgresql.org; Sat, 22 Oct 2022 21:46:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1omMJL-0004OI-So for pgsql-general@arkaria.postgresql.org; Sat, 22 Oct 2022 21:45:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1omMJL-0004LQ-El for pgsql-general@lists.postgresql.org; Sat, 22 Oct 2022 21:45:43 +0000 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1omMJF-0001Cu-27 for pgsql-general@lists.postgresql.org; Sat, 22 Oct 2022 21:45:42 +0000 Received: by mail-oi1-x22b.google.com with SMTP id j188so7129570oih.4 for ; Sat, 22 Oct 2022 14:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5aHs+9vpU2dYMSbLDcZpLmr4f3jctbMgd2vA5V8O7tI=; b=VjOFWtwFHqfNoHzr537RZFJshhPIK1Xmsdx3tV3K/1xW8/IlLMkA19fV0gryfYcU/O 9SR17fw95dvo+UCo/GT3ipu0Cxuc1BrMVpdcVeK+4GMyRNnfqbs/9TA5YCELKL6dcccg 7it/bl6urYAQLzgdhwMQV/XsTtLWeDG37z6D6wrmVC+0OAo5+hpG0knC47aoBPohirhD TdCLJHmxyGTSBG3W+dQirt5C63o4iVy1OAYKsN9kvcPUtssTA0gPnSvbdV9vFHj31+qu WKTWgydomfMXwQA7H8mG+NKykwFmqxk6bceu33AjzUiJIvNxSnZ1Ue9HX7Gn5RfdRNa8 gQoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5aHs+9vpU2dYMSbLDcZpLmr4f3jctbMgd2vA5V8O7tI=; b=jzbStYmYEFyvjFtbOVIAQt6XAX+al5XMARC8+EeHPSdqkGZuVo0i7l2kW5xvIztsNd hp21qoBVyXbl2l+eo6gHk1MQvCfHvHo0AVHDfNjDFdHGkhbEiPIyOjafug6TO/P8p9vr qS2yq7g4nj7tk2CQ1zVFRlMPYMHmhcR+2QC16xO8be09LBGaUaVmvuraO0WYMRVnGThJ NMxz4w5sivNT7hn1ctZAB4mRoAP1DI3B1EMIilZGMYqr62nwJaAxCefRyJ9rLM2zE0pC TtqjyOLttgR0CwqQU9/B2vC7jpa3yQoiTDtdB37McYIW/wcOlCAKsdLTP0Hjve34L9eg BWFA== X-Gm-Message-State: ACrzQf3+ZX5ffcLnsvYSGA53ScRtD5KjZ0s+1TX8KIoU4kf3KTJo32Nz gyuQ47qdi6RUaU5NMK5FYqOiJnKyOC4= X-Google-Smtp-Source: AMsMyM59GAu4a356fDGgQSw8c3RTLsW1dmy1+7ZvIARS6ZVPh05PIbBWc9z9Ox6wxJ19C56M8XwCjw== X-Received: by 2002:aca:1106:0:b0:355:1196:8f73 with SMTP id 6-20020aca1106000000b0035511968f73mr13281681oir.236.1666475136142; Sat, 22 Oct 2022 14:45:36 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id bf33-20020a056808192100b00354948e04e4sm2601550oib.2.2022.10.22.14.45.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Oct 2022 14:45:35 -0700 (PDT) Message-ID: <7d3c6371-b963-1c22-42e3-ecbff8e72f28@gmail.com> Date: Sat, 22 Oct 2022 16:45:35 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: pg_restore 12 "permission denied for schema" errors Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <287717df-88e2-a4a5-2025-260c39662bca@gmail.com> <40fd91d2-d981-2f44-4d58-a3f08a9448fb@familie-gard.de> <2980993.1666242738@sss.pgh.pa.us> <612cf1c4-1f2d-f068-d6cf-54b98bbeb646@gmail.com> <727e6a26-4b58-0aea-a701-9671b8935410@aklaver.com> <119d108c-0669-a15d-2afe-3c4116130118@gmail.com> <4da803e6-407c-19ee-53a0-618c6465ab81@gmail.com> From: Ron In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/22/22 16:29, Adrian Klaver wrote: > On 10/22/22 14:02, Ron wrote: >> On 10/22/22 12:00, Adrian Klaver wrote: >>> On 10/22/22 09:41, Ron wrote: >>>> On 10/22/22 11:20, Adrian Klaver wrote: >>>>> On 10/20/22 14:34, Ron wrote: >>>>>> On 10/20/22 10:02, Adrian Klaver wrote: >>>>>>> On 10/20/22 06:20, Ron wrote: >>>>>>>> On 10/20/22 00:12, Tom Lane wrote: >>>>> >>> >>>> I was afraid you were going to say that. >>>> >>>> The work-around is to: >>>> pg_dump $SRCDB --schema-only | grep -e '^\(GRANT|REVOKE\)' > all_GRANT.sql >>>> pg_dump $SRCDB --schema-only | grep OWNER > all_OWNER.sql >>>> pg_restore --jobs=X --no-owner $NEWDB >>> >>> The above and below have me confused. >>> >>> What is $NEWDB? >>> >>> In above it seems to be a file and below a database name. >> >> Consider it pseudo-code. > > To pseudo for me. > > What file exactly is: > > pg_restore --jobs=X --no-owner $NEWDB > > restoring? > > And how was that file created? > > Knowing this might help get at why the more straight forward method does > not work. This is what I ran to restore the database: export PGHOST=${RDSENV}.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com cd /migrate/TASK001793786/2022-10-19b NEWDB=sides pg_restore -v --create --clean --no-owner --jobs=`nproc` -Fd --dbname=template1 $NEWDB psql $NEWDB -f all_OWNER.sql psql $NEWDB -f all_GRANT.sql The name of the database is "sides", and there's a directorynamed "sides" under /migrate/TASK001793786/2022-10-19b. >> >>> >>>> psql $NEWDB -f all_OWNER.sql >>>> psql $NEWDB -f all_GRANT.sql >>>> >>>> This is, of course, why we need to test the backup/restore process. >>>> >>> >> > -- Angular momentum makes the world go 'round.