Return-Path: owner-postman 
Delivery-Date: Wed, 27 Apr 94 14:49:17 -0700
Return-Path: owner-postman
Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id LAA18665 for postgres-redist; Wed, 27 Apr 1994 11:44:33 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199404271844.LAA18665@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from pollux.cs.uga.edu (pollux.cs.uga.edu [128.192.4.5]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id LAA18650 for <postgres@postgres.berkeley.edu>; Wed, 27 Apr 1994 11:44:31 -0700
From: perera@pollux.cs.uga.edu
Received: by pollux.cs.uga.edu (4.1/25-eef)
	id AA09372; Wed, 27 Apr 94 14:44:27 EDT
Message-Id: <9404271844.AA09372@pollux.cs.uga.edu>
Subject: malloc, palloc question...
To: postgres@postgres.Berkeley.EDU
Date: Wed, 27 Apr 1994 14:44:26 -0400 (EDT)
Content-Type: text
Content-Length: 1954      
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Wed, 27 Apr 94 11:44:33 -0700
Resent-XMts: smtp

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.
===============================================================================

