Re: BUG #16912: pg_dump 11 does not respect --quote-all-identifiers within function bodies

From: Brandon Simmons <brandon(dot)m(dot)simmons(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16912: pg_dump 11 does not respect --quote-all-identifiers within function bodies
Date: 2021-03-04 15:14:35
Message-ID: CAAyGGymK=OvqMh9e72q=J5SEvH8W7_LtJDsynUQMDTA+zeb57A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Mar 4, 2021 at 10:01 AM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Wednesday, March 3, 2021, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
>>
>> The following bug has been logged on the website:
>>
>> Bug reference: 16912
>> Logged by: Brandon Simmons
>> Email address: brandon(dot)m(dot)simmons(at)gmail(dot)com
>> PostgreSQL version: 11.11
>> Operating system: Linux
>> Description:
>>
>> I'm using regex to rewrite identifiers in a SQL dump and rely on the
>> double-quotes.
>> Within plpgsql `CREATE FUNCTION` statements in the resulting dump,
>> identifiers are not quoted as I would expect.
>
>
> PostgreSQL will not do anything to the text values in your database. A function body is just plain text - that is why it gets surrounded with single quotes or, more commonly, dollar-quoting, when written. It only has meaning when interpreted during its execution.

My understanding:
- As far as pg_dump is concerned, function bodies are just text
- this is somewhat desirable too, since comments/formatting (AFAIU)
are preserved in dumps
- It might even be that function bodies are malformed (if `SET
check_function_bodies = false`) and these end up in dump

So I guess this is really a feature request:
- add a mode that dumps function bodies from their AST
- --quote-all-identifiers should apply to the function body AST

I can see why this might never happen. Thanks all!

>
> David J.
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2021-03-04 21:13:56 Re: BUG #16914: Regression test of the worker_spi fails if USE_MODULE_DB environment variable is set.
Previous Message David G. Johnston 2021-03-04 15:01:46 Re: BUG #16912: pg_dump 11 does not respect --quote-all-identifiers within function bodies