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 1sqY6N-00AfQL-1h for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 13:18:44 +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 1sqY6M-00AsK4-O7 for pgsql-general@arkaria.postgresql.org; Tue, 17 Sep 2024 13:18:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqY6M-00AsJs-DM for pgsql-general@lists.postgresql.org; Tue, 17 Sep 2024 13:18:42 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqY6I-001eeB-V2 for pgsql-general@postgresql.org; Tue, 17 Sep 2024 13:18:41 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2f75b13c2a8so63727681fa.3 for ; Tue, 17 Sep 2024 06:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726579118; x=1727183918; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zgBBdSfNHN40wx0hac5oCEuuCwDEkQOowscBzFdfexQ=; b=GqfB9nZMeIeJmm7jWJvqdWh7RqCu4XD1R8DdI1LaXL/HPDrhJnAfyuGM9+PBfFAvUH JhewWdH+ZYkch2LF9AirCXknvb1fgGw3V5+ANfcAr6QqnNSq5Bp7oMJSQwAgmr73cAfX YHEJid2yS6DN7TREkCdoehij9vAYSrAtJtjnO/nj4k0TxC5vmukO7dgv4KzygU1Ioywy VFuKJI6uU9oJsoHePYSwVj8GJlVkOCAFIl8l1y1pZ0LH+rgEcepDwhPIbhaJdOtp5RLm G3VDlebs8NnGF4r0aAKKLRonO3mq8AMJcDQqyfsPSCKp173bdlTKJxCH7tznN6h265Bn Cm/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726579118; x=1727183918; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zgBBdSfNHN40wx0hac5oCEuuCwDEkQOowscBzFdfexQ=; b=uhjRNb6x+sfQyE+nldrHywvQq+d8PbuIB4eYNjuBn0zZ2emJbD4aZ9lWLYAjMPPjiX BaqE2egW+bKZszF55KrPIy9DiV60cLia2KHjisTGn1KFYwtfMy0Lmgybab/FcWS0f5yF RnTIUBAXAu0zw5qT0CRwI5r/ArZF1xHKpas54LC0NaKzG76SS8XjzD3Ec5CLo1dOHUoZ p3DqQ3puGn25H+erup7Dt7Wsiqho84Tnn8/XF6HLAe8Fk27uHxcxWCnkO1YmS4NUkrRg /7nxG7Nn2yIeqG+YGsbpk/GYzyyykpq0NOFri+Cu+gQqK5bau1yt9jYTDyogHR4+Xw1I H7Ig== X-Gm-Message-State: AOJu0YwYpbnDc0jstgU4eyG4qYyLHJzzkAruaSjdACKrv5pB0THhsCjz cAfoiY515gqCMzrgb5Kzcl9RZCFypcRlJOFSKqoodV7Xhud4ue9EfimKBdmeHiln9tsOLRHeju6 FAs/Mjubhvk/r3X7BXpbB7zIsVjw= X-Google-Smtp-Source: AGHT+IFNOJSwwxoT0aCCL8Q9gbzhKfL3eA6o7RRvbfOLPyjWOqnFq1nGi/Aztr8D/7IddQSo3cvk2Ffq6uTe6HzVFR0= X-Received: by 2002:a2e:a58a:0:b0:2f6:6101:5a6c with SMTP id 38308e7fff4ca-2f787da4fcdmr92725271fa.5.1726579118116; Tue, 17 Sep 2024 06:18:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greg Sabino Mullane Date: Tue, 17 Sep 2024 09:18:02 -0400 Message-ID: Subject: Re: question on plain pg_dump file usage To: "Zwettler Markus (OIZ)" Cc: PG-General Mailing List Content-Type: multipart/alternative; boundary="00000000000003182d0622508746" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000003182d0622508746 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Sep 17, 2024 at 8:22=E2=80=AFAM Zwettler Markus (OIZ) < Markus.Zwettler@zuerich.ch> wrote: > pg_dump -F p -f dump.sql =E2=80=A6 > > sed -i "s/old_name/new_name/g" > > psql -f dump.sql =E2=80=A6 > Why not rename afterwards? Just "pg_dump mydb | psql -h newhost -f -" and rename things via ALTER. Certainly much safer than a global replace via sed= . Cheers, Greg --00000000000003182d0622508746 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Sep 17, 2024 at 8:22=E2=80=AFAM Z= wettler Markus (OIZ) <Mark= us.Zwettler@zuerich.ch> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">

pg_dump -F p -f dump.= sql =E2=80=A6

sed -i= "s/old_name/new_name/g"

psql -= f dump.sql =E2=80=A6


Why not rename afterwards? Just=C2=A0"pg_dump mydb | psql -h ne= whost -f -" and rename things via ALTER. Certainly much safer than a g= lobal replace via sed.

Cheers,
Greg=C2= =A0
--00000000000003182d0622508746--