agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: perera@pollux.cs.uga.edu
To: postgres@postgres.Berkeley.EDU
Subject: malloc, palloc question...
Date: Wed, 27 Apr 1994 14:44:26 -0400 (EDT)
Message-ID: <9404271844.AA09372@pollux.cs.uga.edu> (raw)

Hi:

I am using postgres version 4.1, lex, bison 1.21, and gcc 2.5.8

Problem:

When I do the following query "retrieve ( s.all, p.all )" inside
my code, I get a core dump.  If I do the query "retrieve ( s.all )"
everything works fine. Both classes s, and p are there.

Compilation is done as:

gcc -I/usr/postgres/include -L/usr/postgres/lib -lpq

Question:

The problem occurs in frame #0, which is in 
/usr/postgres/src/libpq/fe-pqstubs.c ( I greped for malloc in the
libpq directory and came up with this file name. )

If one is using the libpq.a library should one use palloc instead
of malloc ? Any suggestions or is the problem something else that
I may not have taken into account ?

-- Niranjan


Corefile:

[pollux] gdb sp
GDB is free software and you are welcome to 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.
GDB 4.9, Copyright 1993 Free Software Foundation, Inc...
(gdb) b print.c:21
Breakpoint 1 at 0x8ccc: file print.c, line 21.
(gdb) r
Starting program: /home/staff/perera/project/sp 
Building list of user classes, attributes, and types...
SQL> select * from s, p ;
* retrieve (s.all, p.all) 

Breakpoint 1, PrintQuery (query=0x19968 "retrieve (s.all, p.all)")
    at print.c:21
21              response = (char *) PQexec(query);
(gdb) p response
$1 = 0x0
(gdb) p query
$2 = 0x19968 "retrieve (s.all, p.all)"
(gdb) s
Program received signal 11, Segmentation fault
0xef734634 in malloc ()
(gdb) where
#0  0xef734634 in malloc ()
#1  0xe68c in palloc ()
#2  0xd8d0 in pbuf_alloc ()
#3  0xda08 in pbuf_addValues ()
#4  0xec08 in dump_tuple ()
#5  0xf040 in dump_data ()
#6  0x976c in process_portal ()
#7  0xa5a4 in PQexec ()
#8  0x8cd8 in PrintQuery (query=0x19968 "retrieve (s.all, p.all)")
    at print.c:21
#9  0x49fc in yyparse () at gram.c:897
#10 0x7dc4 in main (argc=1, argv=0xeffff884) at main.c:47
(gdb) 


===============================================================================
    To add/remove yourself from the POSTGRES mailing list: send mail with 
    the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

    If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
    a human will deal with it.  DO NOT post to the "postgres" mailing list.
===============================================================================




reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: perera@pollux.cs.uga.edu
  Subject: Re: malloc, palloc question...
  In-Reply-To: <9404271844.AA09372@pollux.cs.uga.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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