This is a multi-part message in MIME format.
--------------000206060204080909020502
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
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(Comple x),INTERNALLENGTH=16);
but it shows
ERROR: parser

arse 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
--------------000206060204080909020502
Content-Type: text/plain;
name="complex.c~"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="complex.c~"
#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);
}
--------------000206060204080909020502
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)
--------------000206060204080909020502--