
pts=> create table ttest ( id VARCHAR(10) NOT NULL );
NOTICE:  _outNode: don't know how to print type 715
CREATE
pts=>

If I remove the 'NOT NULL', its created properly...this is with source
code as of 30minutes ago...and having wiped out my pgsql directory and
doing a gmake install from that...

It doesn't even seem to be restricted to VARCHAR():

pts=> create table test3 ( id text NOT NULL );
NOTICE:  _outNode: don't know how to print type 715
CREATE
pts=> create index test3_i on test3 ( id );
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
        This probably means the backend terminated abnormally before or
while processing the request.
pts=>


Doing a little more searching, the core file shows as listed below.  I'm
still investigating, but if anyone has an idea of what I might be missing,
or should be looking at, please feel free to pop up :)

Script started on Sat Feb 21 03:41:56 1998
> gdb ~/pgsql/bin/postmaster postgres.core
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.16 (i386-unknown-freebsd), 
Copyright 1996 Free Software Foundation, Inc...
Core was generated by `postgres'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.so...done.
Reading symbols from /usr/lib/libcrypt.so.2.0...done.
Reading symbols from /usr/lib/libm.so.2.0...done.
Reading symbols from /usr/lib/libreadline.so.3.0...done.
Reading symbols from /usr/lib/libtermcap.so.2.1...done.
Reading symbols from /usr/lib/libcurses.so.2.0...done.
Reading symbols from /usr/lib/libc.so.3.1...done.
#0  filepath (filename=0x0) at fd.c:473
473		if (*filename != SEP_CHAR)
(gdb) where
#0  filepath (filename=0x0) at fd.c:473
#1  0xa6a15 in FileNameOpenFile (fileName=0x0, fileFlags=1538, fileMode=384)
    at fd.c:610
#2  0x22920 in _bt_tapecreate (fname=0x0) at nbtsort.c:433
#3  0x22c23 in _bt_spoolinit (index=0x1a5a10, ntapes=7, isunique=0)
    at nbtsort.c:584
#4  0x1d9db in btbuild (heap=0x1a5710, index=0x1a5a10, natts=1, 
    attnum=0x149510, istrat=0x1a6210, pcount=0, params=0x0, finfo=0x0, 
    predInfo=0x149b10) at nbtree.c:164
#5  0xdd2e5 in fmgr_c (finfo=0xefbfb39c, values=0xefbfb3ac, 
    isNull=0xefbfb39b "") at fmgr.c:144
#6  0xdd624 in fmgr (procedureId=338) at fmgr.c:285
#7  0x2d3fa in index_build (heapRelation=0x1a5710, indexRelation=0x1a5a10, 
    numberOfAttributes=1, attributeNumber=0x149510, parameterCount=0, 
    parameter=0x0, funcInfo=0x0, predInfo=0x149b10) at index.c:1753
#8  0x2ca7b in index_create (heapRelationName=0x149470 "t", 
    indexRelationName=0x149450 "t_idx", funcInfo=0x0, attributeList=0x1494b0, 
    accessMethodObjectId=403, numatts=1, attNums=0x149510, 
    classObjectId=0x149530, parameterCount=0, parameter=0x0, predicate=0x0, 
    islossy=0 '\000', unique=0 '\000') at index.c:1218
#9  0x3628d in DefineIndex (heapRelationName=0x149470 "t", 
    indexRelationName=0x149450 "t_idx", accessMethodName=0x84bd9 "btree", 
    attributeList=0x1494b0, parameterList=0x0, unique=0 '\000', predicate=0x0, 
    rangetable=0x0) at defind.c:209
#10 0xb47d6 in ProcessUtility (parsetree=0x14bd50, dest=Remote)
    at utility.c:396
#11 0xb1f26 in pg_exec_query_dest (
    query_string=0xefbfb5f0 "create index t_idx on t ( id );", argv=0x0, 
    typev=0x0, nargs=0, dest=Remote) at postgres.c:649
#12 0xb1e40 in pg_exec_query (
    query_string=0xefbfb5f0 "create index t_idx on t ( id );", argv=0x0, 
    typev=0x0, nargs=0) at postgres.c:597
#13 0xb35e1 in PostgresMain (argc=9, argv=0xefbfd634) at postgres.c:1373
#14 0x5a81a in main (argc=9, argv=0xefbfd634) at main.c:97
(gdb) list
468	{
469		char	   *buf;
470		int			len;
471	
472		/* Not an absolute path name? Then fill in with database path... */
473		if (*filename != SEP_CHAR)
474		{
475			len = strlen(GetDatabasePath()) + strlen(filename) + 2;
476			buf = (char *) palloc(len);
477			sprintf(buf, "%s%c%s", GetDatabasePath(), SEP_CHAR, filename);
(gdb) quit
> exit

Script done on Sat Feb 21 03:42:36 1998



Sat, 21 Feb 1998 03:45:52 -0400 (AST)
The Hermit Hacker <scrappy@hub.org>
Break down the problem...

Further to this...

If I follow this back, the problem appears to be in nbtsort.c, around line
584, where:

#3  0x22c23 in _bt_spoolinit (index=0x1a5a10, ntapes=7, isunique=0)
    at nbtsort.c:584
584                     btspool->bts_itape[i] =
(gdb) list
579                     elog(ERROR, "_bt_spoolinit: out of memory");
580             }
581
582             for (i = 0; i < ntapes; ++i)
583             {
584                     btspool->bts_itape[i] =
585                             _bt_tapecreate(mktemp(strcpy(fname,
TAPETEMP)));
586                     btspool->bts_otape[i] =
587                             _bt_tapecreate(mktemp(strcpy(fname,
TAPETEMP)));
5

Basically, _bt_tapecreate() is being passed a temp name...this doesn't
make sense, does it? 

Why are doing:

        btspool->bts_itape[i] =
                        _bt_tapecreate(mktemp(strcpy(fname, TAPETEMP)));

Instead of just doing:

        btspool->bts_itape[i] =
                        _bt_tapecreate(mktemp(TAPETEMP));

Is there a reason why we are copying TAPETEMP into fname first, and then
freeing it right after? 

Regardless of the above, GDB shows:

	(gdb) print fname
	$1 = 0x1a4ed0 "pg_btsortX21438"

For the above context, which is expected...

But, if I go back one, to inside teh _bt_tapecreate() function, GDB shows: 

#2  0x22920 in _bt_tapecreate (fname=0x0) at nbtsort.c:433
433             tape->bttb_fd = FileNameOpenFile(fname, O_RDWR | O_CREAT |
O_TRUNC, 0600);
(gdb) print fname
$2 = 0x0

Am I missing something with GDB, or did fname lose its value here 
somewhere? 

Marc G. Fournier                                
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 


Sat, 21 Feb 1998 04:08:43 -0400 (AST)
The Hermit Hacker <scrappy@hub.org>
Re: [HACKERS] Break down the problem...