selfmade datatype in C and server-crash - Mailing list pgsql-general

From Markus Schulz
Subject selfmade datatype in C and server-crash
Date
Msg-id 200510042204.07141.msc@antzsystem.de
Whole thread Raw
Responses Re: selfmade datatype in C and server-crash  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,
i'm trying to develop a selfmade pg-datatype derived from type text (at
first) with postgresql 7.4.7.
At first i have taken the original code from textin and textout
($SRC/backend/utils/adt/varlena.c) and compiled them renamed to etextin
and etextout into new .so file.
This works fine and then i've created the new Type like:

CREATE OR REPLACE FUNCTION etextin(cstring)
  RETURNS etext AS
'$libdir/new_types.so', 'etextin'
  LANGUAGE 'c' VOLATILE;

CREATE OR REPLACE FUNCTION etextout(etext)
  RETURNS cstring AS
'$libdir/new_types.so', 'etextout'
  LANGUAGE 'c' VOLATILE;

CREATE TYPE etext (
    INPUT = etextin,
    OUTPUT = etextout,
    INTERNALLENGTH = -1,
    ALIGNMENT=int4,
    STORAGE=EXTENDED
    );

this works also.

But if i'm trying to use the type in a table (for instance table with
only one etext column) the server crashed after inserting the second
(first insert works) tuple or on every select.

What i've missed or doing wrong? Are there any HowTo's on this topic?



--
Markus Schulz

pgsql-general by date:

Previous
From: Richard_D_Levine@raytheon.com
Date:
Subject: Fw: License question
Next
From: "Welty, Richard"
Date:
Subject: Re: License question[VASCL:A1077160A86]