From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Mahendra Singh Thalor <mahi6run(at)gmail(dot)com> |
Cc: | Álvaro Herrera <alvherre(at)kurilemu(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pgsql: Non text modes for pg_dumpall, correspondingly change pg_restore |
Date: | 2025-04-15 11:17:51 |
Message-ID: | 966de369-0109-42df-b250-42240ec20910@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
On 2025-04-14 Mo 6:55 PM, Mahendra Singh Thalor wrote:
>
>
> --- a/src/bin/pg_dump/pg_restore.c
> +++ b/src/bin/pg_dump/pg_restore.c
> @@ -1053,15 +1053,19 @@ get_dbname_oid_list_from_mfile(const char
> *dumpdirpath, SimpleOidStringList *dbn
> while ((fgets(line, MAXPGPATH, pfile)) != NULL)
> {
> Oid db_oid = InvalidOid;
> - char db_oid_str[MAXPGPATH + 1] = "";
> char *dbname;
> + char *p = line;
>
> /* Extract dboid. */
> sscanf(line, "%u", &db_oid);
> - sscanf(line, "%20s", db_oid_str);
> +
> + while(isdigit(*p))
> + p++;
> +
> + Assert(*p == ' ');
>
> /* dbname is the rest of the line */
> - dbname = line + strlen(db_oid_str) + 1;
> + dbname = ++p;
>
> /* Remove \n from dbname. */
> dbname[strlen(dbname) - 1] = '\0';
>
>
I don't think an Assert is the right thing here. It's for things that
should not be possible, and won't trigger anything in a non-assertion
build. This condition should cause a pg_fatal().
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2025-04-15 11:44:16 | Re: pgsql: Add support for basic NUMA awareness |
Previous Message | Mahendra Singh Thalor | 2025-04-14 22:55:42 | Re: pgsql: Non text modes for pg_dumpall, correspondingly change pg_restore |
From | Date | Subject | |
---|---|---|---|
Next Message | Yura Sokolov | 2025-04-15 11:20:24 | Re: Built-in Raft replication |
Previous Message | Aleksander Alekseev | 2025-04-15 11:15:36 | Re: Built-in Raft replication |