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 1tWWCC-00HDVc-M8 for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jan 2025 07:46:13 +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 1tWWCA-006y6S-IF for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jan 2025 07:46:10 +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 1tWWCA-006y6K-5v for pgsql-hackers@lists.postgresql.org; Sat, 11 Jan 2025 07:46:09 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tWWC3-0010W4-1p for pgsql-hackers@postgresql.org; Sat, 11 Jan 2025 07:46:08 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-436a03197b2so19670925e9.2 for ; Fri, 10 Jan 2025 23:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736581561; x=1737186361; 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=2j9pQsXDjEGuVMUMWWIZ9Hc9lkYVrelp9U96albxkvg=; b=hqLMapZADl813EMbEeKnX0hSt98Vg8uq63iYG2v9kbcyuDcONuo3oSjM5d9fKv8h2R lEbl3fOOG0daj8HiRq9SOlGyUyBuRqOo0PzrwNypW4Y7b9sOJoVjF3AAy3/nqa4RvePS v36IM9hlUZAziQvVpot/w/fGlVhWnsR5GuIBgqhOqhQkGGwK7/Of7hXXf9nz7R+sYa3j n/9dsLsdofncmgZVZqK4MfmCPNUorTNPPnLUWkvhLzUkRdil6+fhr22NbqK8Dk7lJ4fc OCOP8heLHmJkJUQOtEqE28dLe6BZbB5diEI8eZMy0nvFgtePnr6W53xAXpz4zfxMH7yF 1A5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736581561; x=1737186361; 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=2j9pQsXDjEGuVMUMWWIZ9Hc9lkYVrelp9U96albxkvg=; b=HDerdX9qZcgFnU+r/9DIjJhIjMPoALulfcNPFQYlelzqmAa+1e5SSKn8ZfWZ4lIs3Z S/Velj4M9A4yLu3/lNPg07HAromLxRLxHED/T+xOh/wp5eYL2MSCDTRdkSmOz0bPuqfh 2J5hMOFmA38J+HAIS8Lieoy+FiAw0LX3CZWjW5lsfoqpYoG0rRF0Jrk0mnorZlyZCVeO oJ8mnhGPTo1GzoczM0oYVMwCSpykHZqcqXg3nmd3DisNlPG3rFKDX+9GPPDVtZnzfTUi lGG+6u3+K7Zi0lyVxwyppP3OH40K93tRk/Qn0oJIFy3ASj4SX0awTnGI7ak9dQxl8D5d VM0w== X-Forwarded-Encrypted: i=1; AJvYcCV/B5XCfloesA1o4UCpHz9ZtJc0c6i0bv5jepYDtxemlXU5rg4KE7KTItQI2fU7sGqIok+gTBOF0vZQbwHu@postgresql.org X-Gm-Message-State: AOJu0YxYwV4FETPh/uMfQVbFCagGSHAoxwMfaS1lRbfJyFCU7IYeNbng G5eWzlgck0HWHUOkmJCxeTDfFaUO9bJsh7dVgRHoYMvtssZpyBVMIZ4azIeqBLnTiObixwmxn/d 007VT37i1uUGrdtOdUf79+pZmUXs= X-Gm-Gg: ASbGncuKLjuD9JMxHLA6xgu0jrFDDo1cucIyJJ/D0hytiUaeLtZZoTnJM2cpcwM+AUi lyM9IKohzUvr/D83MSWLNWuU5EGvhaM9nXrNZowUK X-Google-Smtp-Source: AGHT+IG1Vn5q5dbYNrZ38em6qr5ikmGYUKoReina1wufqopyLDSYyca1Swor8sEBTJosGDqA5pSHbrQAbh/A2gvGHAI= X-Received: by 2002:a05:600c:3b86:b0:434:fe4b:be18 with SMTP id 5b1f17b1804b1-436e26bde73mr130104315e9.18.1736581561000; Fri, 10 Jan 2025 23:46:01 -0800 (PST) MIME-Version: 1.0 References: <740696.1718036463@sss.pgh.pa.us> In-Reply-To: From: Mahendra Singh Thalor Date: Sat, 11 Jan 2025 13:15:49 +0530 X-Gm-Features: AbW1kvb8PXXC7GUUtYCqNeesrkVgqboFktMsaXfaCfxWDNLc5g7rIPixOxfool4 Message-ID: Subject: Re: Non-text mode for pg_dumpall To: jian he Cc: Guillaume Lelarge , Nathan Bossart , Magnus Hagander , Tom Lane , Andrew Dunstan , PostgreSQL-development , Dilip Kumar Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 11 Jan 2025 at 11:19, jian he wrote: > Thanks Jian for the review and testing. > in src/bin/pg_dump/pg_dumpall.c main > i think you need do > > archDumpFormat = parseDumpFormat(formatName); > /* > * Open the output file if required, otherwise use stdout. If required, > * then create new files with global.dat and map.dat names. > */ > if (archDumpFormat != archNull) > { > char toc_path[MAXPGPATH]; > /* > * If directory/tar/custom format is specified then we must provide the > * file name to create one main directory. > */ > if (!filename || strcmp(filename, "") == 0) > pg_fatal("no output directory specified"); > /* TODO: accept the empty existing directory. */ > if (mkdir(filename, 0700) < 0) > pg_fatal("could not create directory \"%s\": %m", > filename); > snprintf(toc_path, MAXPGPATH, "%s/global.dat", filename); > OPF = fopen(toc_path, "w"); > if (!OPF) > pg_fatal("could not open global.dat file: %s", strerror(errno)); > } > else if (filename) > { > OPF = fopen(filename, PG_BINARY_W); > if (!OPF) > pg_fatal("could not open output file \"%s\": %m", > filename); > } > else > OPF = stdout; > > before connectDatabase call. Okay. I will add an error check before connectDatabase call in the next version. > > otherwise if the cluster is not setting up. > ``pg_dumpall --format=d`` > error would be about connection error, not > "pg_dumpall: error: no output directory specified" > > we want ``pg_dumpall --format`` invalid options > to error out even if the cluster is not setting up. > > attached are two invalid option test cases. Thanks. I am also working on test cases. I will add all error test cases in the next version and will include these two also. > > you also need change > > > > > > Send output to the specified file. If this is omitted, the > standard output is used. > > > > ? > > since if --format=d, > > can not be omitted. Okay. I will fix it. -- Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com