about create type

Поиск
Список
Период
Сортировка
От zhuangjifeng
Тема about create type
Дата
Msg-id 3F4EC6C0.7080007@263.net
обсуждение исходный текст
Ответы Re: about create type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Dear Sir:
         I have tried to  create a new Type in  postgreSQL-7.2. The
example is defined in Chapter 39 of extended type. We  do follow your
defination  of "Complex" completely.But there is always an error:

     I entered :
 CREATE TYPE
complex(INPUT=complex_in,OUTPUT=complex_out(Complex),INTERNALLENGTH=16);

 but it shows
ERROR: parser:parse error at   or  near '(' ".

         Could  you  please give me a comprehensible explanation. I
expect to hear from you!
        Thank you very much!

PS: our source code is in attachment
#include "stdio.h"
#include "/usr/local/src/pgsql/src/include/postgres.h"

 typedef struct Complex{
   double x;
   double y;
 }Complex;



Complex *complex_in(char *str)
{ double x,y;
 Complex *result;
 if(sscanf(str,"(%lf,%lf)",&x,&y)!=2)
   { elog(WARN,"complex_in error")
       return NULL;
   }
 result=(Complex *)palloc(sizeof(Complex));
 result->x=x;
 result->y=y;
 return(result);}

char *complex_out(Complex *complex)
{
  char *result;
  if(complex==NULL)
    return(null);

  sprintf(result,"(%g,%g)",complex->x,complex->y);
  return(result);
}

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Karthik K S
Дата:
Сообщение: True64 Unix v5.1 - postgresql-7.2.4 compilation problem
Следующее
От: Tom Lane
Дата:
Сообщение: Re: about create type