Обсуждение: MAC line ends strange issue

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

MAC line ends strange issue

От
Michal Kozusznik
Дата:
Hello<br /> Changing line ends cause replacing function delimiter tag ($BODY$ or even $$) to single quote
character.<br/><br /> How to reproduce:<br /> Scenario 1<br /> 1. Make sure Line Ends are set to MAC (Query window,
Edit> Line Ends > MAC)<br /> 2. Open some function in Editor (RMB > Scripts > Create Script)<br /> 3.
Selectwhole source (CTRL+a) copy it to clip-board (CTRL+c or CTRL+x), paste back (CTRL+v)<br /> 4. Send source to
database<br/><br /> Scenario 2<br /> 1. Make sure Line Ends are NOT set to MAC<br /> 2. Open some function in Editor
(RMB> Scripts > Create Script)<br /> 3. Change Line Ends to MAC (Query window, Edit > Line Ends > MAC)<br
/>4. Send the source do database<br /><br /> See pictures bellow:<br /> original source:<br /><img alt=""
src="cid:part1.09000209.04020808@ifortuna.cz"/><br /><br /> Modified source:<br /><img alt=""
src="cid:part2.05000806.01080402@ifortuna.cz"/><br /><br /><br /><br /><br /> 

Re: MAC line ends strange issue

От
Michal Kozusznik
Дата:
<div class="moz-cite-prefix">Guys, what is the reason of reporting bugs, while you don't even answer?<br /> I reported
quiteimportant issue 4 month ago without any single response. Is it already fixed? Or will remain in further builds?<br
/><br/><br /> On 18.4.2013 10:44, Michal Kozusznik wrote:<br /></div><blockquote
cite="mid:516FB26F.8030003@ifortuna.cz"type="cite"> Hello<br /> Changing line ends cause replacing function delimiter
tag($BODY$ or even $$) to single quote character.<br /><br /> How to reproduce:<br /> Scenario 1<br /> 1. Make sure
LineEnds are set to MAC (Query window, Edit > Line Ends > MAC)<br /> 2. Open some function in Editor (RMB >
Scripts> Create Script)<br /> 3. Select whole source (CTRL+a) copy it to clip-board (CTRL+c or CTRL+x), paste back
(CTRL+v)<br/> 4. Send source to database<br /><br /> Scenario 2<br /> 1. Make sure Line Ends are NOT set to MAC<br />
2.Open some function in Editor (RMB > Scripts > Create Script)<br /> 3. Change Line Ends to MAC (Query window,
Edit> Line Ends > MAC)<br /> 4. Send the source do database<br /><br /> See pictures bellow:<br /> original
source:<br/><img alt="" src="cid:part1.00080105.06070806@ifortuna.cz" /><br /><br /> Modified source:<br /><img alt=""
src="cid:part2.04080003.00010002@ifortuna.cz"/><br /><br /><br /><br /><br /></blockquote><br /> 

Re: MAC line ends strange issue

От
Dave Page
Дата:



On Wed, Aug 21, 2013 at 1:16 PM, Michal Kozusznik <kozusznik.michal@ifortuna.cz> wrote:
Guys, what is the reason of reporting bugs, while you don't even answer?
I reported quite important issue 4 month ago without any single response. Is it already fixed? Or will remain in further builds?

Everybody here is volunteering their time. Whilst we try to respond to every bug report, unfortunately some will get missed or ignored because noone has the time to look at them. If you need guaranteed support, you'll need to talk to one of the PostgreSQL support companies.

FWIW, I can't reproduce the behaviour you describe.

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

Re: MAC line ends strange issue

От
Michal Kozusznik
Дата:

Everybody here is volunteering their time. Whilst we try to respond to every bug report, unfortunately some will get missed or ignored because noone has the time to look at them. If you need guaranteed support, you'll need to talk to one of the PostgreSQL support companies.

I can tell you why some got missed: because of using mailing list for pgadmin support. That's why. We talked about this years ago. Nobody is able to track issues this way.
Just start with bugzilla (or other ticketing system) and nothing will get missed.


FWIW, I can't reproduce the behaviour you describe.


I just reproduced easly the first scenario with Windows7 and pgAdmin 1.16.1


Вложения

Re: MAC line ends strange issue

От
Dave Page
Дата:



On Wed, Aug 21, 2013 at 2:05 PM, Michal Kozusznik <kozusznik.michal@ifortuna.cz> wrote:

Everybody here is volunteering their time. Whilst we try to respond to every bug report, unfortunately some will get missed or ignored because noone has the time to look at them. If you need guaranteed support, you'll need to talk to one of the PostgreSQL support companies.

I can tell you why some got missed: because of using mailing list for pgadmin support. That's why. We talked about this years ago. Nobody is able to track issues this way.
Just start with bugzilla (or other ticketing system) and nothing will get missed.

We already have a bug tracker, we just don't have users posting directly to it because we end up having to deal with a lot of non-bugs which take up even more time.
 


FWIW, I can't reproduce the behaviour you describe.


I just reproduced easly the first scenario with Windows7 and pgAdmin 1.16.1

So the value is shown correctly in the query tool when you create the function, but when the SQL is reverse engineered again, it gets changed?

Please create the function in pgAdmin with debug logging turned on so we can see what gets sent to the server, and send the complete log (please delete it right before starting pgAdmin so it's not too full of irrelevent stuff).

FYI, using the single quotes is valid syntax, but a *quick* look at the code indicates that pgAdmin only does it if it thinks the server is 7.4.x or older (which didn't support dollar quoting). If it's getting that check wrong, I'd be very surprised as that would cause all manner of things to break horribly.

Thanks.

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

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

Re: MAC line ends strange issue

От
Michal Kozusznik
Дата:
On 21.8.2013 15:18, Dave Page wrote:

So the value is shown correctly in the query tool when you create the function, but when the SQL is reverse engineered again, it gets changed?

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$.


FYI, using the single quotes is valid syntax, but a *quick* look at the code indicates that pgAdmin only does it if it thinks the server is 7.4.x or older (which didn't support dollar quoting). If it's getting that check wrong, I'd be very surprised as that would cause all manner of things to break horribly.

We have 8.4 server. Maybe version comparison fails.

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.

Thanx
MK
Вложения

Re: MAC line ends strange issue

От
Dave Page
Дата:
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

Вложения