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 1jvCOS-0008Bh-VR for pgsql-general@arkaria.postgresql.org; Tue, 14 Jul 2020 04:18:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jvCOR-0004w9-BT for pgsql-general@arkaria.postgresql.org; Tue, 14 Jul 2020 04:18:11 +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 1jvCOR-0004w1-15 for pgsql-general@lists.postgresql.org; Tue, 14 Jul 2020 04:18:11 +0000 Received: from mail-oo1-xc43.google.com ([2607:f8b0:4864:20::c43]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jvCOK-0001ze-QO for pgsql-general@lists.postgresql.org; Tue, 14 Jul 2020 04:18:10 +0000 Received: by mail-oo1-xc43.google.com with SMTP id s190so3038533ooa.13 for ; Mon, 13 Jul 2020 21:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=uhr6/+ZHoXqIIbveGn4Qu/EfNQJWRcTW8AsX6vL4hb0=; b=QJXBNR7X9V+bJaT57GkXxbfw27xm6WsxYSrD8x5AgjyN0U5GreSUY71tZQCv0CUq3A IP3JD+QJjpPtbQzWquFVpEV1LFs0cEPLp5lsiSSt4tcW+0/ksud+fzKeDd6Woi+pYbHl VBbJs4ghhX+XRhzfsqWjffrucdTlgURxOIjldtVucaT+CQFQwxVbxYnyTILz6IQQtm6R 0NTI6Xcs2gLUtRo0QoWsI4IzB3D1BHtOElhUW+Q+etnOf/jnTH/+n8ao3lUsiKThA9Gl 180e9WfkaTaG1YVqwuYwIwdumHnH/0+EC4Cg/MSqX5E/WTE+ocH6TCSq4fAJzTPC2S8P xQGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=uhr6/+ZHoXqIIbveGn4Qu/EfNQJWRcTW8AsX6vL4hb0=; b=H+/sZzbq2nBtaldkAtZPW7MVVHbETaNuW9TASLbDBfIaXJVbOcRxkrcCPcLgHk3wB1 CEWwkG83HsvzyI9NorQebP8D5pE+5HZ1a5rFRwh+1tPMtte7bs93c9BsDPLMcHzUXms2 Xn5QwJCwr/mxzys4KpXU85KYDhDa/Pj2PNf2NKEj0CuC2CernXON2UpQ3O/d8Odjwqrd T8Go4hQmIHw8vVK8AAhEPvslZMmxBAdHMKaNRqjOIwChhcYTdjAoxQKJ67GYKmC4SqpQ 9xnd+h4aiD3VOd/cPy3UQe75EciQj8imrTe9Dr3cY2f1dNrDkPG/sBryHd2Tcp+TtAZ0 NXEw== X-Gm-Message-State: AOAM531Nhk5prOI+zAKWO/Hbyd4eRR+46jNcFeyMPI30iqeUwKluqpOj paqqSLfUYIpEpVZ3fFE0v85ZmLSQXFDJNA== X-Google-Smtp-Source: ABdhPJzVXkJa73xuZ22Zpwe3ROPyb+vlJPuH8yd57r0TzlcQiSen5l4rwi5nqNCSKJzZXTFI3ndcQA== X-Received: by 2002:a4a:bd0b:: with SMTP id n11mr2886776oop.66.1594700283664; Mon, 13 Jul 2020 21:18:03 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id x10sm3587552ooq.13.2020.07.13.21.18.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jul 2020 21:18:02 -0700 (PDT) Subject: Re: backup -restore question To: pgsql-general@lists.postgresql.org References: <97dbd799-7a6c-d0bc-deb2-fd56d3cda7a9@aklaver.com> <4e073ca3-9813-0fdb-a31e-4bb55efd4dd5@gmail.com> <6ce138d2-0b27-30ab-5da0-6c9cc0bb69fe@aklaver.com> From: Ron Message-ID: Date: Mon, 13 Jul 2020 23:18:02 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <6ce138d2-0b27-30ab-5da0-6c9cc0bb69fe@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 7/13/20 7:37 PM, Adrian Klaver wrote: > On 7/13/20 2:56 PM, Ron wrote: >> On 7/13/20 2:32 PM, Adrian Klaver wrote: >>> On 7/13/20 12:12 PM, Julie Nishimura wrote: >>>> Hello there, >>>> One of our PostgreSQL 9.4.1  databases has been backed up as *.gz file >>>> with the compression 9 "pg_dump -Z 9". What is the right format of >>>> restore this file when needed? Can I run the restore from a compressed >>>> file or I need to unzip the file first, then run pg_restore? Thanks >>> >>> It depends on whether you dumped using the custom format -Fc or plain(no >>> -F or -Fp). If the custom format then you run pg_restore against it. If >>> the plain format then you will to unzip first then feed the file to psql. >> >> What about this? >> gunzip -c | foo.sql.gz | psql >> > > gunzip -c | test_plain.gz | psql -d test_gz -U postgres > bash: test_plain.gz: command not found > gzip: compressed data not read from a terminal. Use -f to force > decompression. > For help, type: gzip -h > Null display is "NULL". > > I think what you want is: > > gunzip -c test_plain.gz | psql -d test_gz -U postgres > The hazards of not testing code before posting... :) -- Angular momentum makes the world go 'round.