Markus Schulz <msc@antzsystem.de> writes:
> 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;
You'd likely be well advised to declare these STRICT (hint: is the C
code checking for null input?) ... and unless the datatype has weird
semantics, its I/O functions should be IMMUTABLE. This doesn't matter
too much for the system's ordinary use of I/O functions, but for
security you want to make sure the functions are properly marked in
case they get called directly.
> 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.
Getting a stack trace from the crash would be helpful. But the fact
that it only fails on the second try makes me suspicious that it's
a memory-management issue. Count thy pallocs.
regards, tom lane