Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ucRAf-00CwNm-83 for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jul 2025 16:09:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ucRAb-004EGF-BF for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jul 2025 16:09:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ucRAa-004EG7-Ny for pgsql-hackers@lists.postgresql.org; Thu, 17 Jul 2025 16:09:17 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ucRAX-007mkd-1L for pgsql-hackers@lists.postgresql.org; Thu, 17 Jul 2025 16:09:15 +0000 Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-4ab6416496dso13922881cf.1 for ; Thu, 17 Jul 2025 09:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1752768551; x=1753373351; darn=lists.postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=hsnw/wy4d/tarp5ChNdOwU7z+JMA0/JtM0z8LOyfqXk=; b=cCov097Kc5sByktkoZdzSRvO0CsxJi3MGB6KZeQ22Wet85Dvrsogk3aTVHYX3clZm0 qLoqsVT7dxg43JUTjWQcWl3Dy8xYdWjd+uCv9KW47xCck65fGjQ2v8aWHJF6OSlMg26V Rpr/SWmjK+4h3Zjbba0yMTJHZPzgdKbxCBlAsseXocVDbTGQ4bAOJTY4YQ3nW1tQnYMd Yjojut+mVqRPBAzhU6WiBf6iH3++ezXqTwIG5WplnOaEI1oL2yj3Hy5+GC0BpnpSl1Td PmJwHdmdxo15r2OTfanrBg9wh7m+ibPRPazrHuwP7BKkkHUS6Dd0P/yqYLsjnNF2SzrC 1ZpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752768551; x=1753373351; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hsnw/wy4d/tarp5ChNdOwU7z+JMA0/JtM0z8LOyfqXk=; b=KIW4/JdE2f1FSDC4j1lBiPljZUXcpu8Ket40eUEmWG55uxncm1XF32/vj7X6sUUXdl smB4qgrHZnvvh1mwC1E3yOs/+Dc3TONpz0rJNPJmWFtiErNcdWQspsP/rmkh5+kuI8Ce okmszjK7/ePoHs5g3RCvBAQxOTUE2hNoqEDVQEwjFlSsYoA/GuClloglqHVvtn2XLDTu O15rVVsnPcqtZy2eIhJBwV6vSArlytsiRfqQGo/Lg24+kI17cMZMbV4mfVJGADQYkh7H 0nm0RII8Tx4e7OI6YiY6iq5qayaaMx0tiUoHgCnXJhwf07ZIyUPwrgJsl9HEj9fwL2o8 lYfQ== X-Forwarded-Encrypted: i=1; AJvYcCUSr24kNqOBQeLsj6nihmnRtWj9U8bLQF4XEhlbMx3zphtnifZKUOMaXLreM+vl628Z1/PZNfYQOkYjZDoj@lists.postgresql.org X-Gm-Message-State: AOJu0YzNfQPib5ellAZMrQ4+bW4P99CxdS4IW/v7bSSVbJXIZOFV0I8j lfdhciOjVASp5gfyG3jlmo4YuifATMAaWEWa8cdfCNLy6fiXyR1iDKPBwNcc/yOFRYQ= X-Gm-Gg: ASbGncvjl+MP2d1Zd5El4b08aQWkDSRnTg4YNThccfS3FzESsdJrBp6U9OOaahbtX9p 3KS+HI7GpQAvvBpoVnXYP0MQJXPriz2NI+hlQnK/uFkHdxQVGJeQrX1VhsiI9G23ghkGuAss7sk upp631J+D6n57bs4+Ke5k4M7SlCrewIuqYVZ+xlcbOPnEeoHOzuGmy0fRld42GRHjVJwRH8m2/a RSeKBW5QR05LLki8EYMbqahCkqlK3DtMy+b9ydAWha2hQ+Hzt0hJv/X5rxnlUJBylleoq3p5rti 1PzweftbuD8+ih+Ja5DXij+2y6j6M34pkZOcSFGVBSgK6d0movYvztGXFLPMf900ys4O743YiNI xhZDBJhJhkqrZY2WvvFex8Y/r8EEumw== X-Google-Smtp-Source: AGHT+IHhM/CFEL7izU5qq876WsByuUdEVnUMAs5gQUsHRHICSAYcjGYG1Qy7kQMw6mWzFJwoiI+o2A== X-Received: by 2002:a05:622a:8b:b0:4ab:56e5:f71 with SMTP id d75a77b69052e-4abae1b161fmr17054171cf.30.1752768551288; Thu, 17 Jul 2025 09:09:11 -0700 (PDT) Received: from ?IPV6:2605:a601:a6b0:500::1cb? ([2605:a601:a6b0:500::1cb]) by smtp.googlemail.com with ESMTPSA id d75a77b69052e-4ab801e542bsm34883581cf.3.2025.07.17.09.09.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Jul 2025 09:09:10 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------95usRktg9ckOjG7gv5Xx9MYg" Message-ID: <6c540fb7-03d9-4929-8a11-66c2ddccf2b2@dunslane.net> Date: Thu, 17 Jul 2025 12:09:08 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Non-text mode for pg_dumpall To: =?UTF-8?Q?=C3=81lvaro_Herrera?= , Mahendra Singh Thalor Cc: Noah Misch , jian he , Srinath Reddy , pgsql-hackers@lists.postgresql.org References: <202507171111.uo3vvgt6jp6j@alvherre.pgsql> From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunsl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lIY/NFN hFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C4R+M6w7o2PLGOjdZ +kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaYL++LAEOqrlvm2Tvq QqZRtnEAEQEAAcLAfAQYAQgAJgIbDBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ/DuBBQJoGNI2BQkd EODdAAoJEJn6f8tZ/DuBfw0IAKTsfD40teP/pp+bsLLMSxPXUYrrprTj7WFB5v61p6dkpSr/ qXmMlyahdxQFaPmfVgVirB1Vk/kHiWNnnGjfUV9nB2Zg9LI0Xb9/ts3LsUiRWXzG3tkMY6XL vsVOxW4XFRND9l2q+WW93aZ1DZl+fqWfYgMvsusFRhmGFOKTRfKPta2Pkv+AhA24N4+PrR5p bU4k2MO8PAGiK8eaYKGFG1bHKuAvoDoF7WXJ3FHxuWqLnKEt4dfOLm5pAe3zq1Lt6q8azT9i QWGpSAK5vQUWQHBHpiDjdPeqKZ6HiAXIIKfSmb+jrvXBqoP+D6/K7rUjG2aXiRtTIAXms9sm VRu7cmw= In-Reply-To: <202507171111.uo3vvgt6jp6j@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------95usRktg9ckOjG7gv5Xx9MYg Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2025-07-17 Th 7:11 AM, Álvaro Herrera wrote: > On 2025-Jul-17, Mahendra Singh Thalor wrote: > >> To pg_restore, we are giving a dump of pg_dumpall which has a >> global.dat file and we have drop commands in the global.dat file so >> when we are using 'globals-only', we are dropping databases as we have >> DROP commands. >> As of now, we don't have any filter for global.dat file in restore. If >> a user wants to restore only globals(without droping db), then they >> should use 'globals-only' in pg_dumpall. >> Or if we don't want to DROP databases by global.dat file, then we >> should add a filter in pg_restore (hard to implement as we have SQL >> commands in global.dat file). > I think dropping database is dangerous and makes no practical sense; > doing it renders pg_dumpall --clean completely unusable. You're arguing > from the point of view of ease of implementation, but that doesn't help > users. Yeah. I also agree with Noah that we should be consistent with pg_dump. And we should err on the side of caution. If we impose a little inconvenience on the user by requiring them to drop a database, it's better than surprising them by dropping a database when they didn't expect it. There are some subtleties here. pg_restore will only issue DROP DATABASE of you use the -C flag, even if you specify --clean, so we need to be very careful about issuing DROP DATABASE. I confess that all this didn't occur to me when working on the commit. >> I think, for this case, we can do some >> more doc changes. >> Example: pg_restore --globals-only : this will restore the global.dat >> file(including all drop commands). It might drop databases if any drop >> commands. > I don't think doc changes are useful. Yeah, I don't think this is something that can be  cured by documentation. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------95usRktg9ckOjG7gv5Xx9MYg Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2025-07-17 Th 7:11 AM, Álvaro Herrera wrote:
On 2025-Jul-17, Mahendra Singh Thalor wrote:

To pg_restore, we are giving a dump of pg_dumpall which has a
global.dat file and we have drop commands in the global.dat file so
when we are using 'globals-only', we are dropping databases as we have
DROP commands.
As of now, we don't have any filter for global.dat file in restore. If
a user wants to restore only globals(without droping db), then they
should use 'globals-only' in pg_dumpall.
Or if we don't want to DROP databases by global.dat file, then we
should add a filter in pg_restore (hard to implement as we have SQL
commands in global.dat file). 
I think dropping database is dangerous and makes no practical sense;
doing it renders pg_dumpall --clean completely unusable.  You're arguing
from the point of view of ease of implementation, but that doesn't help
users.


Yeah. I also agree with Noah that we should be consistent with pg_dump. And we should err on the side of caution. If we impose a little inconvenience on the user by requiring them to drop a database, it's better than surprising them by dropping a database when they didn't expect it.

There are some subtleties here. pg_restore will only issue DROP DATABASE of you use the -C flag, even if you specify --clean, so we need to be very careful about issuing DROP DATABASE.

I confess that all this didn't occur to me when working on the commit.

I think, for this case, we can do some
more doc changes.
Example: pg_restore --globals-only : this will restore the global.dat
file(including all drop commands). It might drop databases if any drop
commands.
I don't think doc changes are useful.


Yeah, I don't think this is something that can be  cured by documentation.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------95usRktg9ckOjG7gv5Xx9MYg--