> 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 <jian.universal...@gmail.com> 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