Search Postgresql Archives

Re: selfmade datatype in C and server-crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Markus Schulz <msc@xxxxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux