Re: selfmade datatype in C and server-crash
| От | Tom Lane |
|---|---|
| Тема | Re: selfmade datatype in C and server-crash |
| Дата | |
| Msg-id | 13242.1128481290@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | selfmade datatype in C and server-crash (Markus Schulz <msc@antzsystem.de>) |
| Ответы |
Re: selfmade datatype in C and server-crash
|
| Список | pgsql-general |
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
В списке pgsql-general по дате отправления: