pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ecpg with indicators not working
3+ messages / 2 participants
[nested] [flat]

* ecpg with indicators not working
@ 1999-02-17 03:14 James Thompson <jamest@math.ksu.edu>
  1999-02-17 07:38 ` Re: ecpg with indicators not working Michael Meskes <Michael_Meskes@topmail.de>
  0 siblings, 1 reply; 3+ messages in thread

From: James Thompson @ 1999-02-17 03:14 UTC (permalink / raw)
  To: pgsql-interfaces; +Cc: Michael Meskes <Michael.Meskes@gmx.net>


From a previous email

> > >     exec sql
> > >       insert into customer(id,name_first,name_middle,name_last,company,
> > >                       address1,address2,city,state,country,zip,phone_work,
> > >                       phone_home,phone_fax,email,date_entered,billing_terms,
> > >                            confirmation_method)
> > >       values (:id,:name_first, :name_middle, :name_last,
> > >               :company,:address1,:address2,
> > >               :city,:state,:country,:zip,:phone_work,
> > >               :phone_home,:phone_fax,:email,date('now'),
> > >               :billing_terms,
> > >               :confirmation_method);
> >
> > Xou can even add indicators like in
> >
> > ... values (:id,:name_first, :name_middle:nm_ind, :name_last, ...
> >

I tried the following (screwed up spacing due to pine autowrap :-)

    exec sql
      insert into
	customer(uid,id,name_first,name_middle,name_last,company,

	address1,address2,city,state,country,zip,phone_work,

	phone_home,phone_fax,email,date_entered,billing_terms,
                           confirmation_method)
      values (:uid,:uid:id_n,:name_first:name_first_n,
              :name_middle:name_middle_n, :name_last:name_last_n,
              :company:company_n,:address1:address1_n,
              :address2:address2_n,:city:city_n,:state:state_n,
              :country:country_n,:zip:zip_n,:phone_work:phone_work_n,

	:phone_home:phone_home_n,:phone_fax:phone_fax_n,:email:email_n,
              date('now'),:billing_terms:billing_terms_n,
              :confirmation_method:confirmation_method_n);


Adding the indicators to the above statement causes ecpg(from the 6.4.2
distro) to seg fault while processing the statement.  I defined each
indicator as the original var name with _n added to the end.  I tried
type int and long.  The statement preprocesses fine without the indicator
vars.

I dont know the proper method for looking into core files but by trial and
error I got gdb to produce (is this correct way to do this?)

[jamest@calvin obelib]$ gdb ecpg  core
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `ecpg customer.ec'.
Program terminated with signal 11, Segmentation fault.
find_solib: Can't read pathname for load map: Input/output error

#0  0x8054d81 in ECPGdump_a_type ()
(gdb) bt
#0  0x8054d81 in ECPGdump_a_type ()
#1  0x8049973 in dump_variables ()
#2  0x8049941 in dump_variables ()
#3  0x8049941 in dump_variables ()
#4  0x8049941 in dump_variables ()
#5  0x8049941 in dump_variables ()
#6  0x8049941 in dump_variables ()
#7  0x8049941 in dump_variables ()
#8  0x8049941 in dump_variables ()
#9  0x8049941 in dump_variables ()
#10 0x8049941 in dump_variables ()
#11 0x8049941 in dump_variables ()
#12 0x8049941 in dump_variables ()
#13 0x8049941 in dump_variables ()
#14 0x8049941 in dump_variables ()
#15 0x8049941 in dump_variables ()
#16 0x8049941 in dump_variables ()
#17 0x8049941 in dump_variables ()
#18 0x8049fe7 in output_statement ()
#19 0x804b91b in yyparse ()
#20 0x8055475 in main ()

Does anyone have a working example of using indicator vars with ecpg?
Thanks.

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson    138 Cardwell Hall  Manhattan, Ks   66506    785-532-0561 
Kansas State University                          Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<






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

* Re: ecpg with indicators not working
  1999-02-17 03:14 ecpg with indicators not working James Thompson <jamest@math.ksu.edu>
@ 1999-02-17 07:38 ` Michael Meskes <Michael_Meskes@topmail.de>
  1999-02-17 13:36   ` Re: [INTERFACES] Re: ecpg with indicators not working James Thompson <jamest@math.ksu.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Meskes @ 1999-02-17 07:38 UTC (permalink / raw)
  To: pgsql-interfaces

On Tue, Feb 16, 1999 at 09:14:10PM -0600, James Thompson wrote:
>     exec sql
>       insert into
> 	customer(uid,id,name_first,name_middle,name_last,company,
> 
> 	address1,address2,city,state,country,zip,phone_work,
> 
> 	phone_home,phone_fax,email,date_entered,billing_terms,
>                            confirmation_method)
>       values (:uid,:uid:id_n,:name_first:name_first_n,
>               :name_middle:name_middle_n, :name_last:name_last_n,
>               :company:company_n,:address1:address1_n,
>               :address2:address2_n,:city:city_n,:state:state_n,
>               :country:country_n,:zip:zip_n,:phone_work:phone_work_n,
> 
> 	:phone_home:phone_home_n,:phone_fax:phone_fax_n,:email:email_n,
>               date('now'),:billing_terms:billing_terms_n,
>               :confirmation_method:confirmation_method_n);
> 
> 
> Adding the indicators to the above statement causes ecpg(from the 6.4.2
> distro) to seg fault while processing the statement.  I defined each
> indicator as the original var name with _n added to the end.  I tried
> type int and long.  The statement preprocesses fine without the indicator
> vars.

Strange. Please try the attached test file. I defined all your variables as
int and it works with ecpg versions 2.4.4 (PG 6.4.1), 2.4.9 and 2.5.0.

> I dont know the proper method for looking into core files but by trial and
> error I got gdb to produce (is this correct way to do this?)

Yes.

> [jamest@calvin obelib]$ gdb ecpg  core
> GNU gdb 4.17
> ... 
> #0  0x8054d81 in ECPGdump_a_type ()
> (gdb) bt
> ...

Could you please check where in ECPGdump_a_type it dumps core? The function
is a pretty short one.

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.Meskes@gmx.net          | Use PostgreSQL!

Attachments:

tj.pgc (text/plain, 1.2K) download main() { exec sql begin declare section; int uid,id_n,name_first,name_first_n,name_middle,name_middle_n, name_last,name_last_n,company,company_n,address1,address1_n, address2,address2_n,city,city_n,state,state_n, country,country_n,zip,zip_n,phone_work,phone_work_n, phone_home,phone_home_n,phone_fax,phone_fax_n,email,email_n, billing_terms,billing_terms_n,confirmation_method,confirmation_method_n; exec sql end declare section; exec sql insert into customer(uid,id,name_first,name_middle,name_last,company, address1,address2,city,state,country,zip,phone_work, phone_home,phone_fax,email,date_entered,billing_terms, confirmation_method) values (:uid,:uid:id_n,:name_first:name_first_n, :name_middle:name_middle_n, :name_last:name_last_n, :company:company_n,:address1:address1_n, :address2:address2_n,:city:city_n,:state:state_n, :country:country_n,:zip:zip_n,:phone_work:phone_work_n, :phone_home:phone_home_n,:phone_fax:phone_fax_n,:email:email_n, date('now'),:billing_terms:billing_terms_n, :confirmation_method:confirmation_method_n); }
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: [INTERFACES] Re: ecpg with indicators not working
  1999-02-17 03:14 ecpg with indicators not working James Thompson <jamest@math.ksu.edu>
  1999-02-17 07:38 ` Re: ecpg with indicators not working Michael Meskes <Michael_Meskes@topmail.de>
@ 1999-02-17 13:36   ` James Thompson <jamest@math.ksu.edu>
  0 siblings, 0 replies; 3+ messages in thread

From: James Thompson @ 1999-02-17 13:36 UTC (permalink / raw)
  To: Michael Meskes <Michael_Meskes@topmail.de>; +Cc: pgsql-interfaces

On Wed, 17 Feb 1999, Michael Meskes wrote:

> 
> Strange. Please try the attached test file. I defined all your variables as
> int and it works with ecpg versions 2.4.4 (PG 6.4.1), 2.4.9 and 2.5.0.
> 
> > I dont know the proper method for looking into core files but by trial and
> > error I got gdb to produce (is this correct way to do this?)
> 

Yes the test files worked.  Until I added the other variables used in the
insert statement.  I put the following in the sql declare section (too
lazy to type them all).

char *uid,*id,*name_first,*name_middle,*name_last;

And then ecpg bombs with the seg fault.

> 
> Could you please check where in ECPGdump_a_type it dumps core? The function
> is a pretty short one.
> 

Sure, if I can figure out how.  Can I do that via gdb?  Or do I just need
to use puts throughout the function?

I'd also be willing to try the cvs versions if someone could tell me where
to get them, I cant find cvs download instructions on the postgresql site.

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson    138 Cardwell Hall  Manhattan, Ks   66506    785-532-0561 
Kansas State University                          Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<





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


end of thread, other threads:[~1999-02-17 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-17 03:14 ecpg with indicators not working James Thompson <jamest@math.ksu.edu>
1999-02-17 07:38 ` Michael Meskes <Michael_Meskes@topmail.de>
1999-02-17 13:36   ` James Thompson <jamest@math.ksu.edu>

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