Re: Edit query buffer

Lists: pgsql-hackerspgsql-hackers-win32pgsql-patches
From: "Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com>
To: "Postgres Win32" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Edit query buffer
Date: 2004-11-02 19:28:04
Message-ID: 727B82C682D8E8409BD807B361874F4102208FED@xcgmd050.northgrum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

I'm not sure if this goes here or to bugs, but it seems obvious (to me) that if this problem existed elsewhere, it would have been brought up by now.

In the first version of the beta native Windows release, if I try to edit the query buffer using the \e command, psql crashes spectacularly. The error is "The instruction at "0x00422078" referenced memory at "0x00000000". The memory could not be "read"." If I connect from a client machine to the database server and attempt the same thing, psql crashes less spectacularly. It just dies without a whimper. Yes, I have PSQL_EDITOR set to notepad and if I use \e filename, it attempts to open "filename". If it exists, it opens. If it doesn't exist, it asks to create it. If it's any help, when the debugger opens, it says "Unhandled exception in psql.exe: 0xC0000005: Access Violation." Selecting OK, the debugger is sitting on this line:

00422078 mov al,byte ptr [ecx]

if that means anything.

Stepping forward to the present, attempting the same \e in the beta 4 release of psql, it gripes "could not open temporary file ".\psq48F.tmp": File exists". At least now psql doesn't crash, taking the DOS window with it (if you launched psql from the menu).

Coming from an Oracle environment, I kind of like being able to edit the buffer because I don't type very well.


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com>
Cc: Postgres Win32 <pgsql-hackers-win32(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [pgsql-hackers-win32] Edit query buffer
Date: 2004-11-02 19:44:22
Message-ID: 200411021944.iA2JiM527005@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches


I can confirm this bug.

---------------------------------------------------------------------------

Wood, Bruce wrote:
> I'm not sure if this goes here or to bugs, but it seems obvious
> (to me) that if this problem existed elsewhere, it would have
> been brought up by now.
>
> In the first version of the beta native Windows release, if I
> try to edit the query buffer using the \e command, psql crashes
> spectacularly. The error is "The instruction at "0x00422078"
> referenced memory at "0x00000000". The memory could not be
> "read"." If I connect from a client machine to the database
> server and attempt the same thing, psql crashes less spectacularly.
> It just dies without a whimper. Yes, I have PSQL_EDITOR set to
> notepad and if I use \e filename, it attempts to open "filename".
> If it exists, it opens. If it doesn't exist, it asks to create
> it. If it's any help, when the debugger opens, it says "Unhandled
> exception in psql.exe: 0xC0000005: Access Violation." Selecting
> OK, the debugger is sitting on this line:
>
> 00422078 mov al,byte ptr [ecx]
>
> if that means anything.
>
> Stepping forward to the present, attempting the same \e in the
> beta 4 release of psql, it gripes "could not open temporary file
> ".\psq48F.tmp": File exists". At least now psql doesn't crash,
> taking the DOS window with it (if you launched psql from the
> menu).
>
> Coming from an Oracle environment, I kind of like being able to
> edit the buffer because I don't type very well.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index
> scan if your
> joining column's datatypes do not match
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com>
Cc: "Postgres Win32" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: Edit query buffer
Date: 2004-11-03 21:31:23
Message-ID: 17155.1099517483@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

"Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com> writes:
> In the first version of the beta native Windows release, if I try to
> edit the query buffer using the \e command, psql crashes
> spectacularly.

This was fixed two months ago. Why are you still using beta1?

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com>, Postgres Win32 <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: Edit query buffer
Date: 2004-11-04 03:13:15
Message-ID: 200411040313.iA43DFB19685@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

Tom Lane wrote:
> "Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com> writes:
> > In the first version of the beta native Windows release, if I try to
> > edit the query buffer using the \e command, psql crashes
> > spectacularly.
>
> This was fixed two months ago. Why are you still using beta1?

He later stated that he was also testing beta2. I am seeing the same
failure on our newest pginstaller, beta4.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com>, Postgres Win32 <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: Edit query buffer
Date: 2004-11-04 03:18:33
Message-ID: 20179.1099538313@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> He later stated that he was also testing beta2. I am seeing the same
> failure on our newest pginstaller, beta4.

It's not the "same" failure, but it's pretty obvious that the #ifdef
WIN32 code in do_edit() was never actually tested ... and why shouldn't
the stat() logic work on Windows, anyway?

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Wood, Bruce" <Bruce(dot)Wood(at)ngc(dot)com>
Cc: Postgres Win32 <pgsql-hackers-win32(at)postgresql(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Edit query buffer
Date: 2004-11-04 22:24:43
Message-ID: 200411042224.iA4MOhK22644@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches


OK, it turns out there were multiple problems with psql \e and \!
related to quoting and the use of Win32 API functions. That attached
patch fixes both of these, and uses stat() under Win32, but not
WIN32_CLIENT_ONLY.

---------------------------------------------------------------------------

Wood, Bruce wrote:
> I'm not sure if this goes here or to bugs, but it seems obvious
> (to me) that if this problem existed elsewhere, it would have
> been brought up by now.
>
> In the first version of the beta native Windows release, if I
> try to edit the query buffer using the \e command, psql crashes
> spectacularly. The error is "The instruction at "0x00422078"
> referenced memory at "0x00000000". The memory could not be
> "read"." If I connect from a client machine to the database
> server and attempt the same thing, psql crashes less spectacularly.
> It just dies without a whimper. Yes, I have PSQL_EDITOR set to
> notepad and if I use \e filename, it attempts to open "filename".
> If it exists, it opens. If it doesn't exist, it asks to create
> it. If it's any help, when the debugger opens, it says "Unhandled
> exception in psql.exe: 0xC0000005: Access Violation." Selecting
> OK, the debugger is sitting on this line:
>
> 00422078 mov al,byte ptr [ecx]
>
> if that means anything.
>
> Stepping forward to the present, attempting the same \e in the
> beta 4 release of psql, it gripes "could not open temporary file
> ".\psq48F.tmp": File exists". At least now psql doesn't crash,
> taking the DOS window with it (if you launched psql from the
> menu).
>
> Coming from an Oracle environment, I kind of like being able to
> edit the buffer because I don't type very well.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index
> scan if your
> joining column's datatypes do not match
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 5.7 KB