public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andrew Dunstan <[email protected]>
To: Mahendra Singh Thalor <[email protected]>
To: Noah Misch <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: jian he <[email protected]>
Cc: Srinath Reddy <[email protected]>
Cc: [email protected]
Subject: Re: Non-text mode for pg_dumpall
Date: Mon, 21 Jul 2025 16:41:03 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKYtNAppY=vVtTMdkxRPV48cHKyzLeYF6mrPk15Wczme7e9=ww@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<CAKYtNArtO8T-u5=E4ibxFfW+zQ8dBmOZQFgRa36+27NFkdtK0Q@mail.gmail.com>
<[email protected]>
<CAKYtNAoE1xUcMmBq-1qCaZGUDQLfMSVa6hzBVA-PqbmSTzPf5A@mail.gmail.com>
<CAKYtNAq530UTAtnVs5xfONQ0j6vS-Sys50p5+SNfC7G7_ghCVQ@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAKYtNAr-6_CCz+tnJ0T2597Ar4iAZXkE1qPimsO9EY-Kn7LvzQ@mail.gmail.com>
<[email protected]>
<CAKYtNAqXTvfAw-y4FHvzprg72cFrC63cge9xMVDO_R4=NHc5rA@mail.gmail.com>
<CAKYtNAppY=vVtTMdkxRPV48cHKyzLeYF6mrPk15Wczme7e9=ww@mail.gmail.com>
On 2025-07-17 Th 6:18 AM, Mahendra Singh Thalor wrote
>>>>>> --- a/src/bin/pg_dump/pg_restore.c
>>>>>> +++ b/src/bin/pg_dump/pg_restore.c
>>>>>> +/*
>>>>>> + * read_one_statement
>>>>>> + *
>>>>>> + * This will start reading from passed file pointer using fgetc and read till
>>>>>> + * semicolon(sql statement terminator for global.dat file)
>>>>>> + *
>>>>>> + * EOF is returned if end-of-file input is seen; time to shut down.
>>>>> What makes it okay to use this particular subset of SQL lexing?
>>>> To support complex syntax, we used this code from another file.
>>> I'm hearing that you copied this code from somewhere. Running
>>> "git grep 'time to shut down'" suggests you copied it from
>>> InteractiveBackend(). Is that right? I do see other similarities between
>>> read_one_statement() and InteractiveBackend().
>>>
>>> Copying InteractiveBackend() provides negligible assurance that this is the
>>> right subset of SQL lexing. Only single-user mode uses InteractiveBackend().
>>> Single-user mode survives mostly as a last resort for recovering from having
>>> reached xidStopLimit, is rarely used, and only superusers write queries to it.
>> Yes, we copied this from InteractiveBackend to read statements from
>> global.dat file.
Maybe we should ensure that identifiers with CR or LF are turned into
Unicode quoted identifiers, so each SQL statement would always only
occupy one line. Or just reject role and tablespace names with CR or LF
altogether, just as we do for database names.
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
view thread (100+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Non-text mode for pg_dumpall
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox