pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedECPG failed and Postmaster getting bigger in using perl Pg
8+ messages / 4 participants
[nested] [flat]
* ECPG failed and Postmaster getting bigger in using perl Pg
@ 2000-05-10 02:21 S.F. Lee <sflee_tw@yahoo.com>
0 siblings, 1 reply; 8+ messages in thread
From: S.F. Lee @ 2000-05-10 02:21 UTC (permalink / raw)
To: pgsql-interfaces
Hi everyone,
I am revamping a computer system by Red Hat 6.0 +
PostgreSQL 6.5.3 + ecpg 2.7 + C. The user interface is
perl Pg + Apache. Everything seems fine, but when I
use "top" to display long term CPU processes, I find
the postmaster is getting bigger in step of 4 kb and
performance is getting worse GRADUALLY (It seems that
perl + Pg would make the size expansion more quickly
than ECPG). Here are some data display in "top":
PID SIZE RSS SHARE TIME COMMAND
2526 1260 1260 1040 0:00 postmaster --
when postmaster started
2526 28384 20M 388 4:41 postmaster --
2 days later
I didn't find any error in tracing my program, and
the child postmaster is terminated correctly. I really
can't figure out the reason. Please give me advise.
I have installed the latest version 7.0RC5, but I
find my C program fails in ECPG 2.7 although it works
fine in PostgreSQL 6.5.3, Postmaster is getting bigger
too (perl + Pg), Here is a simple example:
1. I create a table foo_1 and insert 2 rows of data:
CREATE TABLE foo_1
(
recno int PRIMARY KEY, -- PRIMARY KEY
a1 int,
b1 float,
spare int
);
insert into foo_1 values(1,10,11.1,0);
insert into foo_1 values(2,20,22.2,0);
2. I write a program (Test.pgc) to get a whole row
into a structure temp by "select *":
/*
exec sql whenever sqlerror sqlprint;
*/
exec sql include sqlca;
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
main()
{
exec sql begin declare section;
struct data
{
int recno;
int a1;
float b1;
int spare;
} temp;
int PK_INDEX;
exec sql end declare section;
exec sql connect to by2db;
if (sqlca.sqlcode != 0)
{
printf ("connect database error =
%s\n",sqlca.sqlerrm.sqlerrmc);
exit (-1);
}
PK_INDEX = 1;
exec sql select * into :temp from foo_1 where recno
= :PK_INDEX;
if (sqlca.sqlcode != 0)
{
printf ("sql_select--foo_1 :
%s\n",sqlca.sqlerrm.sqlerrmc);
exit (-1);
}
printf (" a1 = %d b1 = %f\n",temp.a1,temp.b1);
exec sql disconnect all;
exit(0);
}
After executing program(Test), I got different result
in each version of PostgreSQL,
such as:
In PostgreSQL 6.5.3 + ecpg 2.7 : a1 = 10 b1 =
11.100000
In PostgreSQL 7.0RC5 + ecpg 2.7 : sql_select--foo_1
: Too few arguments in line 33.
I would REALLY appreciate some suggestions.
Thanks
S.F.Lee
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: ECPG failed and Postmaster getting bigger in using perl Pg
@ 2000-05-10 06:13 SAKAIDA Masaaki <sakaida@psn.co.jp>
parent: S.F. Lee <sflee_tw@yahoo.com>
0 siblings, 1 reply; 8+ messages in thread
From: SAKAIDA Masaaki @ 2000-05-10 06:13 UTC (permalink / raw)
To: S.F. Lee <sflee_tw@yahoo.com>; +Cc: pgsql-interfaces
"S.F. Lee" <sflee_tw@yahoo.com> wrote:
> After executing program(Test), I got different result
> in each version of PostgreSQL,
> such as:
>
> In PostgreSQL 6.5.3 + ecpg 2.7 : a1 = 10 b1 =
> 11.100000
>
> In PostgreSQL 7.0RC5 + ecpg 2.7 : sql_select--foo_1
> : Too few arguments in line 33.
This is a bug of pre-processor in PostgreSQL-7.0RC5.
The solutions of the bug:
1. Don't use a struct host variable.
old) exec sql select * into :temp ...
new) exec sql select a1,b1 into :temp.a1, :temp.b1 ...
2. Apply the next patch.
inline patch 1: postgresql-7.0RC5/src/interfaces/ecpg/preproc/type.c (+6/-0 lines) download inline-1.patch
*** postgresql-7.0RC5/src/interfaces/ecpg/preproc/type.c.orig Wed May 10 14:45:55 2000
--- postgresql-7.0RC5/src/interfaces/ecpg/preproc/type.c Wed May 10 14:46:43 2000
***************
*** 198,203 ****
--- 198,209 ----
void
ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *ind_name, struct ECPGtype * ind_typ, const char *prefix, const char *ind_prefix)
{
+ if (ind_typ == NULL)
+ {
+ ind_typ = &ecpg_no_indicator;
+ ind_name = "no_indicator";
+ }
+
switch (typ->typ)
{
case ECPGt_array:
--
Regards,
SAKAIDA Masaaki -- Osaka, Japan
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: ECPG failed and Postmaster getting bigger in using perl Pg
@ 2000-05-10 07:42 Michael Meskes <meskes@postgresql.org>
parent: SAKAIDA Masaaki <sakaida@psn.co.jp>
0 siblings, 2 replies; 8+ messages in thread
From: Michael Meskes @ 2000-05-10 07:42 UTC (permalink / raw)
To: pgsql-interfaces
On Wed, May 10, 2000 at 03:13:56PM +0900, SAKAIDA Masaaki wrote:
> This is a bug of pre-processor in PostgreSQL-7.0RC5.
ARGH!
> The solutions of the bug:
>
> 1. Don't use a struct host variable.
Not really a solution.
> 2. Apply the next patch.
>
> *** postgresql-7.0RC5/src/interfaces/ecpg/preproc/type.c.orig Wed May 10 14:45:55 2000
> --- postgresql-7.0RC5/src/interfaces/ecpg/preproc/type.c Wed May 10 14:46:43 2000
> ***************
> *** 198,203 ****
> --- 198,209 ----
> void
> ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *ind_name, struct ECPGtype * ind_typ, const char *prefix, const char *ind_prefix)
> {
> + if (ind_typ == NULL)
> + {
> + ind_typ = &ecpg_no_indicator;
> + ind_name = "no_indicator";
> + }
> +
This has been in before. I have no idea where it got lost. To make matters
worse this has not made it into the archive before 7.0 was released right?
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De | Use PostgreSQL!
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: ECPG failed and Postmaster getting bigger in using perl Pg
@ 2000-05-10 10:53 SAKAIDA Masaaki <sakaida@psn.co.jp>
parent: Michael Meskes <meskes@postgresql.org>
1 sibling, 1 reply; 8+ messages in thread
From: SAKAIDA Masaaki @ 2000-05-10 10:53 UTC (permalink / raw)
To: Michael Meskes <meskes@postgresql.org>; +Cc: pgsql-interfaces
Michael Meskes <meskes@postgresql.org> wrote:
> > This is a bug of pre-processor in PostgreSQL-7.0RC5.
>
> ARGH!
>
> > The solutions of the bug:
> >
> > 1. Don't use a struct host variable.
>
> Not really a solution.
This solution would be effective only when ecpg is not fixed ;-).
> > 2. Apply the next patch.
> >
> > *** postgresql-7.0RC5/src/interfaces/ecpg/preproc/type.c.orig Wed May 10 14:45:55 2000
> > --- postgresql-7.0RC5/src/interfaces/ecpg/preproc/type.c Wed May 10 14:46:43 2000
> > ***************
> > *** 198,203 ****
> > --- 198,209 ----
> > void
> > ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *ind_name, struct ECPGtype * ind_typ, const char *prefix, const char *ind_prefix)
> > {
> > + if (ind_typ == NULL)
> > + {
> > + ind_typ = &ecpg_no_indicator;
> > + ind_name = "no_indicator";
> > + }
> > +
>
> This has been in before. I have no idea where it got lost.
Probably, when you were editting it, you have made a mistake,
I think :-).
BTW If ecpg is fixed, we can use a struct indicator, too. (ex.
select * into :temp :ind_temp from foo_1 ..) It is wonderful that
such a struct host variable can be used. Ecpg is very good tool.
--
Regards,
SAKAIDA Masaaki -- Osaka, Japan
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: ECPG failed and Postmaster getting bigger in using perl Pg
@ 2000-05-10 13:52 Tom Lane <tgl@sss.pgh.pa.us>
parent: Michael Meskes <meskes@postgresql.org>
1 sibling, 1 reply; 8+ messages in thread
From: Tom Lane @ 2000-05-10 13:52 UTC (permalink / raw)
To: Michael Meskes <meskes@postgresql.org>; +Cc: pgsql-interfaces
Michael Meskes <meskes@postgresql.org> writes:
> ARGH!
> This has been in before. I have no idea where it got lost. To make matters
> worse this has not made it into the archive before 7.0 was released right?
Nope, not if it wasn't in CVS on Monday evening :-(. Oh well, there's
most certainly going to be a 7.0.1 ...
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: ECPG failed and Postmaster getting bigger in using perl Pg
@ 2000-05-11 08:14 Michael Meskes <meskes@postgresql.org>
parent: SAKAIDA Masaaki <sakaida@psn.co.jp>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Meskes @ 2000-05-11 08:14 UTC (permalink / raw)
To: pgsql-interfaces
On Wed, May 10, 2000 at 07:53:28PM +0900, SAKAIDA Masaaki wrote:
> This solution would be effective only when ecpg is not fixed ;-).
It will be.
> Probably, when you were editting it, you have made a mistake,
> I think :-).
Yup. But then I still don't know how I managed to do that.
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De | Use PostgreSQL!
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: ECPG failed and Postmaster getting bigger in using perl Pg
@ 2000-05-11 08:14 Michael Meskes <meskes@postgresql.org>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Meskes @ 2000-05-11 08:14 UTC (permalink / raw)
To: pgsql-interfaces
On Wed, May 10, 2000 at 09:52:48AM -0400, Tom Lane wrote:
> Nope, not if it wasn't in CVS on Monday evening :-(. Oh well, there's
> most certainly going to be a 7.0.1 ...
Hopefully pretty soon.
Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De | Use PostgreSQL!
^ permalink raw reply [nested|flat] 8+ messages in thread
* ecpg failed and Postmaster getting bigger
@ 2000-05-18 07:58 S.F. Lee <sflee_tw@yahoo.com>
0 siblings, 0 replies; 8+ messages in thread
From: S.F. Lee @ 2000-05-18 07:58 UTC (permalink / raw)
To: pgsql-interfaces
>>
values(1,10,11.1,`{1,2,3,4}`,`{"1.1","2.2","3.3"}`,0);
>Is c1 int[3] or int[4]?
sorry,
values(1,10,11.1,`{1,2,3}`,`{"1.1","2.2","3.3"}`,0);
>> 2.Modify Test.pgc to get a whole row from foo_2
into
>> a structure temp by "select *":
>> printf (" c1 = %s d1 = %s
>> ",temp.a1,temp.b1,temp.c1,temp.d1);
>This one dumps core on me since a1 and b1 are not
mentioned in the format
>string. But I guess this is not your problem. :-)
sorry, that's all my fault. :-(
printf (" c1 = %s d1 = %s
",temp.c1,temp.d1);
In PostgreSQL 6.5.3, I can't use
struct data
{
int recno;
int a1;
float b1;
int c1[3];
float d1[3];
int spare;
} temp;
as a host variable, but I find
struct data
{
int recno;
int a1;
float b1;
char c1[50];
char d1[50];
int spare;
} temp;
can apply for getting a whole row into
structure temp by "select * ". One of
the most important reason that I would
use PostgreSQL is array, that could make
me easier in building up table. And the
reason why I would like to use "select *"
is to reduce the complication in programming.
since I can use some utility to build up a
correct structure according to foo_2.sql, then
all I want is dealing with the structure.
Sorry for my poor English.
Regards, S.F. Lee
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2000-05-18 07:58 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-05-10 02:21 ECPG failed and Postmaster getting bigger in using perl Pg S.F. Lee <sflee_tw@yahoo.com>
2000-05-10 06:13 ` SAKAIDA Masaaki <sakaida@psn.co.jp>
2000-05-10 07:42 ` Michael Meskes <meskes@postgresql.org>
2000-05-10 10:53 ` SAKAIDA Masaaki <sakaida@psn.co.jp>
2000-05-11 08:14 ` Michael Meskes <meskes@postgresql.org>
2000-05-10 13:52 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-05-11 08:14 ` Michael Meskes <meskes@postgresql.org>
2000-05-18 07:58 ecpg failed and Postmaster getting bigger S.F. Lee <sflee_tw@yahoo.com>
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