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 1tc4sD-00FN6Y-A4 for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Jan 2025 15:48:33 +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 1tc4sC-007Rgd-4n for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Jan 2025 15:48:32 +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 1tc4sB-007RgU-PE for pgsql-hackers@lists.postgresql.org; Sun, 26 Jan 2025 15:48:31 +0000 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tc4s9-001cML-0X for pgsql-hackers@postgresql.org; Sun, 26 Jan 2025 15:48:30 +0000 Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-6d8ece4937fso33784986d6.2 for ; Sun, 26 Jan 2025 07:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737906509; x=1738511309; 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=AT7ctr0CQimyA28w3H0mDIHxB3fV+JSo0bXGGeOK3TI=; b=Nloh3V+3oAluuhGoZbTRpGfwBy+vsnkECe8QqpC+ZhiyRSKHTGJqddoANZkABJIMOY XEsIvjmK1IhHXSXnJP6wf7zC/4bitMIFEzQSwMq4WLh7lVs2bhxZPmTEZOm90EvPxF0L 4BYjtHlCAif0uFUv3iezNfDMdWPQDwhfA47c9m0ke4JC8F4W0JoHmb7qMoKWrFl78l2T 3wZIyAsmdEEuo/bbdzOA/cXHZTGWZgd9lGTLJxvVCs1/FQygUVm63UbqFWYc1khhd5D6 7JEK9Vg+WOExFROcxuGkb0k87/D606KVB5EhXsqy+TTA2LBHBTMKvpNeqWwJ99f6aB08 8Wng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737906509; x=1738511309; 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=AT7ctr0CQimyA28w3H0mDIHxB3fV+JSo0bXGGeOK3TI=; b=Z7zqrKxenQg1qbNcdw4DICA6FYmXZXbW/pVSQOSldtPRS5xR9etxa5WFih7JMlaAfd i3MOHEdJHrawHKon+Q5goVnjmV4YmrGZk0h5RF4aapH0QENwEjzjpbsNuj/gPjm7fdxk ev4b1kNiNnkKGXKJs9hWXyiqIDaZRpM1rw23E0QO/jDNZjn2788G1C/U57yxWW60EVlw RA5b8ZHhSqyZ6q4ifCmqNno2DPQqdT3HAe7LOPPq3Yopqi4i6haX0H0llN7Z2qhcomfX TnZZWG//u37i+xGbR112lgwjRLsvkZFz7pU1teI9HSKILM0ynciHDFNr77K3EMenNRtR 339Q== X-Forwarded-Encrypted: i=1; AJvYcCUh+hPs4hP+lgl3saVsdUGnn9GFdlwYZYrpKsxvYAlOFjds+8/t5OlLAL4ou+1as/HJyJdMQYhilm1/tv7X@postgresql.org X-Gm-Message-State: AOJu0YxPbDPFk2uhPJTx2ntQN+9+mEhEG46PcXSBhIO5rT9oS9hj6e/j ry226viH8RHq3N0KCiqov8dVE6qhB+oTIBDIY0BeRrBGzioYyi1FoPN3uBJShx4CpROS9f/ujSk PiTXW9Vh26cgBuwztyegSO6K0K3g= X-Gm-Gg: ASbGncvTCJp4+e6KgSUFyf8NA3ol++H6sj/lfH2qzj4dfzQ0H/2w2NC3Rn49gA0gG0e NiKkJQ7pdv6bYeefw3thQs69/Pv+w4PCpIvbS0/3jkzhMjIwPjYy7goiAjc8fRVA= X-Google-Smtp-Source: AGHT+IEnjIjfWyQAFReiMt9b85fifpnhyfJQimEAGMYzULT16Eu/v8jLWaEwz1dnGrH/oEzjC0hJu52gUhh/TK1ZWyo= X-Received: by 2002:ad4:5c6d:0:b0:6e1:6aa2:2156 with SMTP id 6a1803df08f44-6e1b224c283mr464898896d6.30.1737906508813; Sun, 26 Jan 2025 07:48:28 -0800 (PST) MIME-Version: 1.0 References: <202501110844.5ztsym4vbflm@alvherre.pgsql> In-Reply-To: From: Mahendra Singh Thalor Date: Sun, 26 Jan 2025 21:18:16 +0530 X-Gm-Features: AWEUYZlDN87LfXJ5X0tq8osLwmBSlQw1Xaxf3Mve63KtzEHwDTbAxgaBfm_YKUs Message-ID: Subject: Re: Non-text mode for pg_dumpall To: jian he Cc: Alvaro Herrera , 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 > hi. > After some tests and thinking about your reply, I admit that using > expand_dbname_patterns > in pg_restore will not work. > We need to do pattern matching against the map.dat file. > Please check the attached v12 series based on your > v11_pg_dumpall-with-directory-tar-custom-format-21-jan.patch > > v12-0001 cosmetic change. > v12-0002 implement pg_resore --exclude-database=PATTERN. > main gist of implementation: > for each database name in map.dat file, > check if this database name pattern matches with PATTERN or not. > pattern matching is using processSQLNamePattern. > > your substring will not work. > some of the test cases. > $BIN10/pg_restore --exclude-database=* -Cd template1 --verbose dir10 > > dir_format 2>&1 Hi, As per discussion with Robert Haas and Dilip Kumar, we thought that we can't assume that there will be a db connection every time while doing pg_restore but in attached patch, we are assuming that we have a db connection. In my previous updates, I already mentioned this problem. I think, we should not use connection for --exclude-database, rather we should use direct functions to validate patterns or we should restrict as NAME only. On Sun, 26 Jan 2025 at 20:17, jian he wrote: > > hi. > attached patching trying to refactor ReadOneStatement > for properly handling the single and double quotes. > the commit message also has some tests on it. > > it is based on your > v11_pg_dumpall-with-directory-tar-custom-format-21-jan.patch. I think, instead of char, if we read line by line, then we don't need that much code and need not to worry about double quotes. In the next version, I will merge some patches and will change it to read line by line. -- Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com