Thread

  1. postgresql 7.1.1 and textout and textin

    Jaume Teixi <teixi@6tems.com> — 2001-06-27T13:42:14Z

    hello,
    
    trying to migrate production servers form 7.0.2 to 7.1.1 now I need to
    compile an function written in c and when compiling using following
    includes:
    
    #include <postgres.h>
    #include <utils/builtins.h>
    #include <utils/palloc.h>
    #include <string.h>
    
    I get following compile errors:
    
    c:82: warning: passing arg 1 of `textout' from incompatible pointer type
    
    line 82:  src = textout( src_string );
    
    c:238: warning: passing arg 1 of `textin' from incompatible pointer type
    
    line 238:  return( (text *)textin( ret ) );
    
    function I'm trying to port is this one:
    http://www.ca.postgresql.org/mhonarc/pgsql-sql/1998-06/msg00119.html
    
    
    any points to convert textout and textin to 7.1 ?
    
    thanks from barcelona!
    
    jaume.
    
    
  2. Re: postgresql 7.1.1 and textout and textin

    lockhart@fourpalms.org — 2001-06-27T14:03:21Z

    > trying to migrate production servers form 7.0.2 to 7.1.1 now I need to
    > compile an function written in c
    ...
    > I get following compile errors:
    > c:82: warning: passing arg 1 of `textout' from incompatible pointer type
    > line 82:  src = textout( src_string );
    ...
    > any points to convert textout and textin to 7.1 ?
    
    Look in src/backend/utils/adt/ for examples of functions called from
    within other functions. You will want to upgrade to the new calling
    convention for functions, and will need to use some macros and "direct
    call" wrappers to accomplish this.
    
    It is easy, you just need to match up an example with what you want. Let
    us know if you don't find one and we can do some searching to suggest a
    specific example...
    
                         - Thomas
    
    
  3. Re: Re: postgresql 7.1.1 and textout and textin

    Tom Lane <tgl@sss.pgh.pa.us> — 2001-06-27T15:04:39Z

    Thomas Lockhart <lockhart@fourpalms.org> writes:
    >> any points to convert textout and textin to 7.1 ?
    
    > Look in src/backend/utils/adt/ for examples of functions called from
    > within other functions. You will want to upgrade to the new calling
    > convention for functions, and will need to use some macros and "direct
    > call" wrappers to accomplish this.
    
    There are also some useful examples in contrib/.  Several contrib
    modules have macros like
    
    #define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
    
    #define _textout(str) DatumGetPointer(DirectFunctionCall1(textout, PointerGetDatum(str)))
    
    which work pretty much the same as the old textin() and textout()
    functions did.
    
    			regards, tom lane