Thread

  1. Bug in user-defined types?

    Adriaan Joubert <a.joubert@albourne.com> — 2001-04-02T07:53:37Z

    Hi,
    
    	In response to comments made here, I have been rewriting the unsigned
    types as externally loadable. Using the same routines that worked fine
    when linked statically into the backend gives me core-dumps only.
    Creating only a single uint2 type with I/O routines, I get
    
    test=# create table u2 ( u uint2);
    CREATE
    test=# insert into u2 values (12::uint2);
    pqReadData() -- backend closed the channel unexpectedly.
            This probably means the backend terminated abnormally
            before or while processing the request.
    
    Running this under gdb (I tried this on alpha as well)
    
    backend> insert into u2 values (12::uint2);
    (no debugging symbols found)...
    Program received signal SIGSEGV, Segmentation fault.
    0x40115573 in memcpy () from /lib/libc.so.6
    (gdb) where
    #0  0x40115573 in memcpy () from /lib/libc.so.6
    #1  0x80cfb92 in _copyConst ()
    #2  0x80d25d9 in copyObject ()
    #3  0x80ebad9 in expression_tree_mutator ()
    #4  0x80eb407 in eval_const_expressions_mutator ()
    #5  0x80ebe42 in expression_tree_mutator ()
    #6  0x80eb407 in eval_const_expressions_mutator ()
    #7  0x80ebdf2 in expression_tree_mutator ()
    #8  0x80eb407 in eval_const_expressions_mutator ()
    #9  0x80eaf87 in eval_const_expressions ()
    #10 0x80e6d2a in preprocess_expression ()
    #11 0x80e6751 in subquery_planner ()
    #12 0x80e66c0 in planner ()
    #13 0x81036e7 in pg_plan_query ()
    #14 0x81038d9 in pg_exec_query_string ()
    #15 0x81049d4 in PostgresMain ()
    #16 0x80ce884 in main ()
    #17 0x400d8a42 in __libc_start_main () from /lib/libc.so.6
    (gdb)
    
    It never seems to get to my code. So either I've defined something
    incorrectly or there is a bug. I'd appreciate it if somebody more
    knowledgable than I could have a look at it. I've included a tar with
    the definitions.
    
    BTW it may be good to update the complex example to the new C-calling
    interface, as there is no example of creating a type with the new
    calling interface.
    
    Cheers,
    
    Adriaan