pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PQprint under Windows
8+ messages / 2 participants
[nested] [flat]

* PQprint under Windows
@ 2006-02-06 00:13 Christoph Zwerschke <cito@online.de>
  2006-02-06 02:23 ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Christoph Zwerschke @ 2006-02-06 00:13 UTC (permalink / raw)
  To: pgsql-interfaces

I tried to compile PyGreSQL under Windows.
Everything seems to work, except some functions which are using PQprint. 
Whenever these functions are called, I get a Windows exception.

I am using the following versions:

Windows XP SP2
Python: 2.4.2
PostgreSQL 8.1.2
PyGreSQL 3.8

For compilation I used MinGW and Microsoft Visual C++ Toolkit 2003, both 
  work fine, but both have the same problem mentioned above.

Can anybody confirm that PQprint is or was ever running under Windows? 
The 8.1 docu does not say that it is deprecated or not running under 
Windows. Can it be a bug?

I also noticed that the HTML code in PQprint is not very clean and 
sometimes even wrong, e.g. it has <centre> instead of <center>.

-- Christoph



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: PQprint under Windows
  2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
@ 2006-02-06 02:23 ` Bruce Momjian <pgman@candle.pha.pa.us>
  2006-02-06 09:43   ` Re: PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-06 23:27   ` Re: PQprint under Windows Christoph Zwerschke <cito@online.de>
  0 siblings, 2 replies; 8+ messages in thread

From: Bruce Momjian @ 2006-02-06 02:23 UTC (permalink / raw)
  To: Christoph Zwerschke <cito@online.de>; +Cc: pgsql-interfaces

Christoph Zwerschke wrote:
> I tried to compile PyGreSQL under Windows.
> Everything seems to work, except some functions which are using PQprint. 
> Whenever these functions are called, I get a Windows exception.
> 
> I am using the following versions:
> 
> Windows XP SP2
> Python: 2.4.2
> PostgreSQL 8.1.2
> PyGreSQL 3.8
> 
> For compilation I used MinGW and Microsoft Visual C++ Toolkit 2003, both 
>   work fine, but both have the same problem mentioned above.
> 
> Can anybody confirm that PQprint is or was ever running under Windows? 
> The 8.1 docu does not say that it is deprecated or not running under 
> Windows. Can it be a bug?

It should work.  What exception are you getting, and what line in the C
file is it complaining about?

> I also noticed that the HTML code in PQprint is not very clean and 
> sometimes even wrong, e.g. it has <centre> instead of <center>.

Fixed in 8.1.X.

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: PQprint under Windows
  2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-06 02:23 ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
@ 2006-02-06 09:43   ` Christoph Zwerschke <cito@online.de>
  2006-02-07 00:26     ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 1 reply; 8+ messages in thread

From: Christoph Zwerschke @ 2006-02-06 09:43 UTC (permalink / raw)
  To: pgsql-interfaces

Bruce Momjian wrote:
> Christoph Zwerschke wrote:
>> Can anybody confirm that PQprint is or was ever running under Windows? 
>> The 8.1 docu does not say that it is deprecated or not running under 
>> Windows. Can it be a bug?
 >
> It should work.  What exception are you getting, and what line in the C
> file is it complaining about?

I'll probably need to compile it again with appropriate debug options to 
find that out.

>> I also noticed that the HTML code in PQprint is not very clean and 
>> sometimes even wrong, e.g. it has <centre> instead of <center>.
> 
> Fixed in 8.1.X.

Thanks. If you're already at it, there are also two occurrences of

<caption align=high>

"high" is actually not a possible attribute value here. What was meant 
is probably "top". Also, the attribute should be put in double quotes:

<caption align="top">

This will allow to further process the output with XML tools.

-- Christoph



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: PQprint under Windows
  2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-06 02:23 ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  2006-02-06 09:43   ` Re: PQprint under Windows Christoph Zwerschke <cito@online.de>
@ 2006-02-07 00:26     ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: Bruce Momjian @ 2006-02-07 00:26 UTC (permalink / raw)
  To: Christoph Zwerschke <cito@online.de>; +Cc: pgsql-interfaces

Christoph Zwerschke wrote:
> Bruce Momjian wrote:
> > Christoph Zwerschke wrote:
> >> Can anybody confirm that PQprint is or was ever running under Windows? 
> >> The 8.1 docu does not say that it is deprecated or not running under 
> >> Windows. Can it be a bug?
>  >
> > It should work.  What exception are you getting, and what line in the C
> > file is it complaining about?
> 
> I'll probably need to compile it again with appropriate debug options to 
> find that out.

OK.

> >> I also noticed that the HTML code in PQprint is not very clean and 
> >> sometimes even wrong, e.g. it has <centre> instead of <center>.
> > 
> > Fixed in 8.1.X.
> 
> Thanks. If you're already at it, there are also two occurrences of
> 
> <caption align=high>
> 
> "high" is actually not a possible attribute value here. What was meant 
> is probably "top". Also, the attribute should be put in double quotes:
> 
> <caption align="top">
> 
> This will allow to further process the output with XML tools.

Fixed, thanks.  Will be in 8.1.X.

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: PQprint under Windows
  2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-06 02:23 ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
@ 2006-02-06 23:27   ` Christoph Zwerschke <cito@online.de>
  2006-02-07 01:23     ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  2006-02-07 01:24     ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 2 replies; 8+ messages in thread

From: Christoph Zwerschke @ 2006-02-06 23:27 UTC (permalink / raw)
  To: pgsql-interfaces

Bruce Momjian wrote:
> Christoph Zwerschke wrote:
>> I tried to compile PyGreSQL under Windows.
>> Everything seems to work, except some functions which are using PQprint. 
>> Whenever these functions are called, I get a Windows exception.
 >> ...
>> Can anybody confirm that PQprint is or was ever running under Windows? 
>> The 8.1 docu does not say that it is deprecated or not running under 
>> Windows. Can it be a bug?
> 
> It should work.  What exception are you getting, and what line in the C
> file is it complaining about?

Here is the exception I am getting:
-------------------------------------------------------------------
pythonw.exe caused an Invalid Handle at location 7c974ed1 in module 
ntdll.dll.

Registers:
eax=0021f6a0 ebx=00000000 ecx=0021f6e8 edx=7c91eb94 esi=7c38b528 
edi=00000000
eip=7c974ed1 esp=0021f6a0 ebp=0021f6f0 iopl=0         nv up ei pl zr na 
po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000 
efl=00000246

Call stack:
7C974ED1  ntdll.dll:7C974ED1  RtlRaiseStatus
7C95243C  ntdll.dll:7C95243C  RtlInitializeSListHead
7C91104B  ntdll.dll:7C91104B  RtlEnterCriticalSection
77C1174F  msvcrt.dll:77C1174F  fwrite
6311321C  libpq.dll:6311321C  pg_encoding_to_char
63114007  libpq.dll:63114007  pg_encoding_to_char
63114067  libpq.dll:63114067  pg_encoding_to_char
631094A2  libpq.dll:631094A2  PQprint
10003DC3  _pg.dll:10003DC3  _onexit  dllcrt1.c:183
_onexit_t _onexit(
	_onexit_t pfn = &0x00a7a110
-------------------------------------------------------------------

This happened when I was using the libpq.dll from the official binary 
distribution of PostgreSQL 8.1.2. When I compiled libpq.dll myself to 
find out more, amazingly everything worked fine, there was no exception. 
I compiled with nls enabled and without, both works. Only the dll which 
comes with the Win installer causes the problem. Any ideas what could be 
the problem here?

>> I also noticed that the HTML code in PQprint is not very clean and 
>> sometimes even wrong, e.g. it has <centre> instead of <center>.
> 
> Fixed in 8.1.X.

As already mentioned, there is also a wrong attribute align=high and as 
I just saw, also align=left and align=right attributes without quotes.

-- Christoph




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: PQprint under Windows
  2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-06 02:23 ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  2006-02-06 23:27   ` Re: PQprint under Windows Christoph Zwerschke <cito@online.de>
@ 2006-02-07 01:23     ` Bruce Momjian <pgman@candle.pha.pa.us>
  2006-02-07 18:05       ` Re: PQprint under Windows Christoph Zwerschke <cito@online.de>
  1 sibling, 1 reply; 8+ messages in thread

From: Bruce Momjian @ 2006-02-07 01:23 UTC (permalink / raw)
  To: Christoph Zwerschke <cito@online.de>; +Cc: pgsql-interfaces

Christoph Zwerschke wrote:
> >> I also noticed that the HTML code in PQprint is not very clean and 
> >> sometimes even wrong, e.g. it has <centre> instead of <center>.
> > 
> > Fixed in 8.1.X.
> 
> As already mentioned, there is also a wrong attribute align=high and as 
> I just saw, also align=left and align=right attributes without quotes.

Here is the patchI applied based on your report.  I already fixed the
"centre" cases.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/interfaces/libpq/fe-print.c
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v
retrieving revision 1.65
diff -c -c -r1.65 fe-print.c
*** src/interfaces/libpq/fe-print.c	6 Feb 2006 02:23:07 -0000	1.65
--- src/interfaces/libpq/fe-print.c	7 Feb 2006 00:23:54 -0000
***************
*** 256,262 ****
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<table %s><caption align=high>%d</caption>\n",
  							po->tableOpt ? po->tableOpt : "", i);
  				else
  					fprintf(fout, libpq_gettext("-- RECORD %d --\n"), i);
--- 256,262 ----
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<table %s><caption align=\"top\">%d</caption>\n",
  							po->tableOpt ? po->tableOpt : "", i);
  				else
  					fprintf(fout, libpq_gettext("-- RECORD %d --\n"), i);
***************
*** 276,287 ****
  				{
  					if (po->caption)
  						fprintf(fout,
! 							  "<table %s><caption align=high>%s</caption>\n",
  								po->tableOpt ? po->tableOpt : "",
  								po->caption);
  					else
  						fprintf(fout,
! 								"<table %s><caption align=high>"
  								"Retrieved %d rows * %d fields"
  								"</caption>\n",
  						   po->tableOpt ? po->tableOpt : "", nTups, nFields);
--- 276,287 ----
  				{
  					if (po->caption)
  						fprintf(fout,
! 							  "<table %s><caption align=\"top\">%s</caption>\n",
  								po->tableOpt ? po->tableOpt : "",
  								po->caption);
  					else
  						fprintf(fout,
! 								"<table %s><caption align=\"top\">"
  								"Retrieved %d rows * %d fields"
  								"</caption>\n",
  						   po->tableOpt ? po->tableOpt : "", nTups, nFields);
***************
*** 406,413 ****
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<tr><td align=left><b>%s</b></td>"
! 							"<td align=%s>%s</td></tr>\n",
  							fieldNames[j],
  							fieldNotNum[j] ? "left" : "right",
  							pval);
--- 406,413 ----
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<tr><td align=\"left\"><b>%s</b></td>"
! 							"<td align=\"%s\">%s</td></tr>\n",
  							fieldNames[j],
  							fieldNotNum[j] ? "left" : "right",
  							pval);
***************
*** 502,508 ****
  
  		if (po->html3)
  		{
! 			fprintf(fout, "<th align=%s>%s</th>",
  					fieldNotNum[j] ? "left" : "right", fieldNames[j]);
  		}
  		else
--- 502,508 ----
  
  		if (po->html3)
  		{
! 			fprintf(fout, "<th align=\"%s\">%s</th>",
  					fieldNotNum[j] ? "left" : "right", fieldNames[j]);
  		}
  		else
***************
*** 546,552 ****
  		char	   *p = fields[row_index * nFields + field_index];
  
  		if (po->html3)
! 			fprintf(fout, "<td align=%s>%s</td>",
  					fieldNotNum[field_index] ? "left" : "right", p ? p : "");
  		else
  		{
--- 546,552 ----
  		char	   *p = fields[row_index * nFields + field_index];
  
  		if (po->html3)
! 			fprintf(fout, "<td align=\"%s\">%s</td>",
  					fieldNotNum[field_index] ? "left" : "right", p ? p : "");
  		else
  		{

Attachments:

  [text/plain] /rtmp/diff (2.9K, ../../200602070123.k171NRA27993@candle.pha.pa.us/2-%2Frtmp%2Fdiff)
  download | inline:
Index: src/interfaces/libpq/fe-print.c
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v
retrieving revision 1.65
diff -c -c -r1.65 fe-print.c
*** src/interfaces/libpq/fe-print.c	6 Feb 2006 02:23:07 -0000	1.65
--- src/interfaces/libpq/fe-print.c	7 Feb 2006 00:23:54 -0000
***************
*** 256,262 ****
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<table %s><caption align=high>%d</caption>\n",
  							po->tableOpt ? po->tableOpt : "", i);
  				else
  					fprintf(fout, libpq_gettext("-- RECORD %d --\n"), i);
--- 256,262 ----
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<table %s><caption align=\"top\">%d</caption>\n",
  							po->tableOpt ? po->tableOpt : "", i);
  				else
  					fprintf(fout, libpq_gettext("-- RECORD %d --\n"), i);
***************
*** 276,287 ****
  				{
  					if (po->caption)
  						fprintf(fout,
! 							  "<table %s><caption align=high>%s</caption>\n",
  								po->tableOpt ? po->tableOpt : "",
  								po->caption);
  					else
  						fprintf(fout,
! 								"<table %s><caption align=high>"
  								"Retrieved %d rows * %d fields"
  								"</caption>\n",
  						   po->tableOpt ? po->tableOpt : "", nTups, nFields);
--- 276,287 ----
  				{
  					if (po->caption)
  						fprintf(fout,
! 							  "<table %s><caption align=\"top\">%s</caption>\n",
  								po->tableOpt ? po->tableOpt : "",
  								po->caption);
  					else
  						fprintf(fout,
! 								"<table %s><caption align=\"top\">"
  								"Retrieved %d rows * %d fields"
  								"</caption>\n",
  						   po->tableOpt ? po->tableOpt : "", nTups, nFields);
***************
*** 406,413 ****
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<tr><td align=left><b>%s</b></td>"
! 							"<td align=%s>%s</td></tr>\n",
  							fieldNames[j],
  							fieldNotNum[j] ? "left" : "right",
  							pval);
--- 406,413 ----
  			{
  				if (po->html3)
  					fprintf(fout,
! 							"<tr><td align=\"left\"><b>%s</b></td>"
! 							"<td align=\"%s\">%s</td></tr>\n",
  							fieldNames[j],
  							fieldNotNum[j] ? "left" : "right",
  							pval);
***************
*** 502,508 ****
  
  		if (po->html3)
  		{
! 			fprintf(fout, "<th align=%s>%s</th>",
  					fieldNotNum[j] ? "left" : "right", fieldNames[j]);
  		}
  		else
--- 502,508 ----
  
  		if (po->html3)
  		{
! 			fprintf(fout, "<th align=\"%s\">%s</th>",
  					fieldNotNum[j] ? "left" : "right", fieldNames[j]);
  		}
  		else
***************
*** 546,552 ****
  		char	   *p = fields[row_index * nFields + field_index];
  
  		if (po->html3)
! 			fprintf(fout, "<td align=%s>%s</td>",
  					fieldNotNum[field_index] ? "left" : "right", p ? p : "");
  		else
  		{
--- 546,552 ----
  		char	   *p = fields[row_index * nFields + field_index];
  
  		if (po->html3)
! 			fprintf(fout, "<td align=\"%s\">%s</td>",
  					fieldNotNum[field_index] ? "left" : "right", p ? p : "");
  		else
  		{

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: PQprint under Windows
  2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-06 02:23 ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  2006-02-06 23:27   ` Re: PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-07 01:23     ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
@ 2006-02-07 18:05       ` Christoph Zwerschke <cito@online.de>
  0 siblings, 0 replies; 8+ messages in thread

From: Christoph Zwerschke @ 2006-02-07 18:05 UTC (permalink / raw)
  To: pgsql-interfaces

Bruce Momjian wrote:
> Christoph Zwerschke wrote:
>> As already mentioned, there is also a wrong attribute align=high and as 
>> I just saw, also align=left and align=right attributes without quotes.
> 
> Here is the patchI applied based on your report.  I already fixed the
> "centre" cases.

Yes, that's what I meant.

-- Christoph



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: PQprint under Windows
  2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
  2006-02-06 02:23 ` Re: PQprint under Windows Bruce Momjian <pgman@candle.pha.pa.us>
  2006-02-06 23:27   ` Re: PQprint under Windows Christoph Zwerschke <cito@online.de>
@ 2006-02-07 01:24     ` Bruce Momjian <pgman@candle.pha.pa.us>
  1 sibling, 0 replies; 8+ messages in thread

From: Bruce Momjian @ 2006-02-07 01:24 UTC (permalink / raw)
  To: Christoph Zwerschke <cito@online.de>; +Cc: pgsql-interfaces

Christoph Zwerschke wrote:
> Bruce Momjian wrote:
> > Christoph Zwerschke wrote:
> >> I tried to compile PyGreSQL under Windows.
> >> Everything seems to work, except some functions which are using PQprint. 
> >> Whenever these functions are called, I get a Windows exception.
>  >> ...
> >> Can anybody confirm that PQprint is or was ever running under Windows? 
> >> The 8.1 docu does not say that it is deprecated or not running under 
> >> Windows. Can it be a bug?
> > 
> > It should work.  What exception are you getting, and what line in the C
> > file is it complaining about?
> 
> Here is the exception I am getting:
> -------------------------------------------------------------------
> pythonw.exe caused an Invalid Handle at location 7c974ed1 in module 
> ntdll.dll.
> 
> Registers:
> eax=0021f6a0 ebx=00000000 ecx=0021f6e8 edx=7c91eb94 esi=7c38b528 
> edi=00000000
> eip=7c974ed1 esp=0021f6a0 ebp=0021f6f0 iopl=0         nv up ei pl zr na 
> po nc
> cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000 
> efl=00000246
> 
> Call stack:
> 7C974ED1  ntdll.dll:7C974ED1  RtlRaiseStatus
> 7C95243C  ntdll.dll:7C95243C  RtlInitializeSListHead
> 7C91104B  ntdll.dll:7C91104B  RtlEnterCriticalSection
> 77C1174F  msvcrt.dll:77C1174F  fwrite
> 6311321C  libpq.dll:6311321C  pg_encoding_to_char
> 63114007  libpq.dll:63114007  pg_encoding_to_char
> 63114067  libpq.dll:63114067  pg_encoding_to_char
> 631094A2  libpq.dll:631094A2  PQprint
> 10003DC3  _pg.dll:10003DC3  _onexit  dllcrt1.c:183
> _onexit_t _onexit(
> 	_onexit_t pfn = &0x00a7a110
> -------------------------------------------------------------------
> 
> This happened when I was using the libpq.dll from the official binary 
> distribution of PostgreSQL 8.1.2. When I compiled libpq.dll myself to 
> find out more, amazingly everything worked fine, there was no exception. 
> I compiled with nls enabled and without, both works. Only the dll which 
> comes with the Win installer causes the problem. Any ideas what could be 
> the problem here?

Wow, that is strange.  Guess we will just wait for someone else to see
the failure if you can not reproduce it.  Thanks for trying.

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2006-02-07 18:05 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-06 00:13 PQprint under Windows Christoph Zwerschke <cito@online.de>
2006-02-06 02:23 ` Bruce Momjian <pgman@candle.pha.pa.us>
2006-02-06 09:43   ` Christoph Zwerschke <cito@online.de>
2006-02-07 00:26     ` Bruce Momjian <pgman@candle.pha.pa.us>
2006-02-06 23:27   ` Christoph Zwerschke <cito@online.de>
2006-02-07 01:23     ` Bruce Momjian <pgman@candle.pha.pa.us>
2006-02-07 18:05       ` Christoph Zwerschke <cito@online.de>
2006-02-07 01:24     ` Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox