Subject: Error in using GetAttributeByName in a function

From: [email-masked]
Date: Sat, 26 Nov 1994 21:09:16 -0600 (CST)

Hi postgressers, 

My function given below doesn't work.  

/*  method_folder.c  - to retrieve tuples with fldrname = "DEFAULT" */

#include "/home/coyote/postgres/src/backend/tmp/libpq.h"
#include <utils/builtins.h>
#include <tmp/libpq-fe.h>

bool method_folder(t)
TUPLE t;

{
    char folder_name[100];

    strcpy(folder_name, (char *) GetAttributeByName(t,"fldrname"));
    printf ("FOLDER NAME %s\n",folder_name);
    if (!(strcmp(folder_name,"DEFAULT")))  
       return (1);
    else
       return (0);
}

I used the following command to define the function :

  define function method_folder (language = "c", returntype = bool) arg is 
  (FOLDERS) as "/home/coyote/postgres/final/method_folder.o"  \g

I ran the function with the command :

  retrieve (FOLDERS.all) where method_folder(FOLDERS) \g

The error message I get is : 

Welcome to the C POSTGRES terminal monitor

Go 
* 
Query sent to backend is "retrieve (FOLDERS.all) where method_folder(FOLDERS) "
WARN:Nov 26 20:44:22:GetAttributeByName: a NULL isNull flag was passed
sed

Go 

Any suggestions would be appreciated.

Thanks,

Sriram Kal.

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]".
   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/