Re: MAC line ends strange issue

Поиск
Список
Период
Сортировка
От Dave Page
Тема Re: MAC line ends strange issue
Дата
Msg-id CA+OCxowS2W5SoquiuS1S4ycSGB4YpBveL304V6+zQk=OJtJ4Rw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: MAC line ends strange issue  (Michal Kozusznik <kozusznik.michal@ifortuna.cz>)
Список pgadmin-support
On Wed, Aug 21, 2013 at 2:43 PM, Michal Kozusznik
<kozusznik.michal@ifortuna.cz> wrote:
> On 21.8.2013 15:18, Dave Page wrote:
>
> Something is changed during storing function definition to db. You may open
> existing, properly looking function in sql editor, change EOLs to MAC, and
> hit F5. After that, refresh function in object tree - the function will
> contain quotes instead of $body$.

No, the quotes aren't stored in the DB. pgAdmin figures them out when
it reconstructs the SQL.

> We have 8.4 server. Maybe version comparison fails.

I doubt you'd even be able to connect without a ton of errors if that
were the case.

> I'm attaching the log for following operations:
> - refreshing function in tree (select function and hit F5)
> - open the function (properly looking) function by using Scripts/Create
> script from context menu (before it, EOLs has been set to Unix format)
> - changing EOL format to MAC
> - storing function by hitting F5
> - refreshing function in tree (select function and hit F5)
>
> Ha... To fix the function appearance, it is enough to switch back to Unix
> EOLs. Replacing quotes by $$ is not needed.

I was able to reproduce this eventually, and the issue occurs because
the quoting function is designed to use dollar quoting if the string
(the function body in this case) contains a ' or \n, and regular
quoting otherwise. When you select the Mac line end option (which you
almost certainly shouldn't - that's *classic* Mac line ends; OS X uses
Unix line ends), the quoting function doesn't think that dollar
quoting is required.

The attached patch fixes it for me - any see any reasons why this
might be a bad idea?


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Вложения

В списке pgadmin-support по дате отправления:

Предыдущее
От: Michal Kozusznik
Дата:
Сообщение: Re: MAC line ends strange issue
Следующее
От: pico truncado
Дата:
Сообщение: help