Re: Bogus duplicate command issued in pg_dump

2022-01-23 Thread David G. Johnston
On Sun, Jan 23, 2022 at 7:25 PM Michael Paquier wrote: > On Sun, Jan 23, 2022 at 01:31:03PM -0500, Tom Lane wrote: > > We could consider a more global change to get rid of using > > appendPQExpBuffer where it's not absolutely necessary, so that > > there are fewer bad examples to copy. Another i

Re: Bogus duplicate command issued in pg_dump

2022-01-23 Thread Michael Paquier
On Sun, Jan 23, 2022 at 01:31:03PM -0500, Tom Lane wrote: > We could consider a more global change to get rid of using > appendPQExpBuffer where it's not absolutely necessary, so that > there are fewer bad examples to copy. Another idea is to deem > it an anti-pattern to end a query with a semicol

Re: Bogus duplicate command issued in pg_dump

2022-01-23 Thread Tom Lane
"David G. Johnston" writes: > I just spent 10 minutes thinking you were wrong because I confused the > upgrade_query and upgrade_buffer variables in that function. > You might just as well have fixed the first upgrade_query command to be > print instead of append. And, better yet, renamed its va

Re: Bogus duplicate command issued in pg_dump

2022-01-23 Thread David G. Johnston
On Sun, Jan 23, 2022 at 11:31 AM Tom Lane wrote: > > res = ExecuteSqlQueryForSingleRow(fout, upgrade_query->data); > ... > appendPQExpBuffer(upgrade_query, > "SELECT t.oid, t.typarray " > ... > res = ExecuteSqlQueryForSingleRow(fou

Bogus duplicate command issued in pg_dump

2022-01-23 Thread Tom Lane
While investigating for 353708e1f, I happened to notice that pg_dump's binary_upgrade_set_type_oids_by_type_oid() contains PQExpBuffer upgrade_query = createPQExpBuffer(); ... appendPQExpBuffer(upgrade_query, "SELECT typarray " ... res = ExecuteSqlQueryFor