Обсуждение: 7.4.6 to 8.2.5 - ' changes to $_$

Поиск
Список
Период
Сортировка

7.4.6 to 8.2.5 - ' changes to $_$

От
Steve Clark
Дата:
function from 7.4.x postgres

CREATE FUNCTION update_dns(text, text) RETURNS integer
      AS 'UPDATE domain_details SET domain = $2 WHERE domain = $1;
      DELETE from domains where domain = $1;
      SELECT 1 AS ignore;'
      LANGUAGE sql;

I load it into 8.2.5 - then dump it out and it is changed to


CREATE FUNCTION update_dns(text, text) RETURNS integer
      AS $_$UPDATE domain_details SET domain = $2 WHERE domain = $1;
      DELETE from domains where domain = $1;
      SELECT 1 AS ignore;$_$
      LANGUAGE sql;

notice $_$ where the single ' use to be.

Is there some way to keep this from happening?

The reason is we have systems in the field that have configuration
information stored in 7.4.x.
We want to upload that db info load it into an 8.2.5 db massage it
then send it back to the unit
in the field. I realize there are things I am going to have to fix up
in the 8.2.5 dump to be able to load
it back into the 7.4.x db but I want to minimize that as much as possible.

We have some units in the field running 8.1.3 and it does not change
the ' to $_$.


Thanks,
Steve

Re: 7.4.6 to 8.2.5 - ' changes to $_$

От
Bricklen Anderson
Дата:
Steve Clark wrote:
>
> function from 7.4.x postgres
>
> CREATE FUNCTION update_dns(text, text) RETURNS integer
>      AS 'UPDATE domain_details SET domain = $2 WHERE domain = $1;
>      DELETE from domains where domain = $1;
>      SELECT 1 AS ignore;'
>      LANGUAGE sql;
>
> I load it into 8.2.5 - then dump it out and it is changed to
>
>
> CREATE FUNCTION update_dns(text, text) RETURNS integer
>      AS $_$UPDATE domain_details SET domain = $2 WHERE domain = $1;
>      DELETE from domains where domain = $1;
>      SELECT 1 AS ignore;$_$
>      LANGUAGE sql;
>
> notice $_$ where the single ' use to be.
>
> Is there some way to keep this from happening?
>
> The reason is we have systems in the field that have configuration
> information stored in 7.4.x.
> We want to upload that db info load it into an 8.2.5 db massage it then
> send it back to the unit
> in the field. I realize there are things I am going to have to fix up in
> the 8.2.5 dump to be able to load
> it back into the 7.4.x db but I want to minimize that as much as possible.
>
> We have some units in the field running 8.1.3 and it does not change the
> ' to $_$.
>
>
> Thanks,
> Steve

I think "--disable-dollar-quoting" will work. (pg_dump --help)

Re: 7.4.6 to 8.2.5 - ' changes to $_$

От
Steve Clark
Дата:
Bricklen Anderson wrote:
> Steve Clark wrote:
>
>>function from 7.4.x postgres
>>
>>CREATE FUNCTION update_dns(text, text) RETURNS integer
>>     AS 'UPDATE domain_details SET domain = $2 WHERE domain = $1;
>>     DELETE from domains where domain = $1;
>>     SELECT 1 AS ignore;'
>>     LANGUAGE sql;
>>
>>I load it into 8.2.5 - then dump it out and it is changed to
>>
>>
>>CREATE FUNCTION update_dns(text, text) RETURNS integer
>>     AS $_$UPDATE domain_details SET domain = $2 WHERE domain = $1;
>>     DELETE from domains where domain = $1;
>>     SELECT 1 AS ignore;$_$
>>     LANGUAGE sql;
>>
>>notice $_$ where the single ' use to be.
>>
>>Is there some way to keep this from happening?
>>
>>The reason is we have systems in the field that have configuration
>>information stored in 7.4.x.
>>We want to upload that db info load it into an 8.2.5 db massage it then
>>send it back to the unit
>>in the field. I realize there are things I am going to have to fix up in
>>the 8.2.5 dump to be able to load
>>it back into the 7.4.x db but I want to minimize that as much as possible.
>>
>>We have some units in the field running 8.1.3 and it does not change the
>>' to $_$.
>>
>>
>>Thanks,
>>Steve
>
>
> I think "--disable-dollar-quoting" will work. (pg_dump --help)
>
>

Thanks a lot. I missed that option in the man page - but now I see it.