Re: CREATE FUNCTION and LANGUAGE 'C' - Mailing list pgsql-sql

From Tom Lane
Subject Re: CREATE FUNCTION and LANGUAGE 'C'
Date
Msg-id 8828.1015282702@sss.pgh.pa.us
Whole thread Raw
In response to CREATE FUNCTION and LANGUAGE 'C'  (Céline Rivière <cr@fr.netcentrex.net>)
List pgsql-sql
Céline Rivière <cr@fr.netcentrex.net> writes:
> CREATE FUNCTION Get_Length(TEXT)=20
> RETURNS INTEGER
> AS
>  '/home/ncxusers/criviere/TOOLS/lib/tools.so', 'Get_Length'
> LANGUAGE 'C';

> This is the C implementation of GetLength :

> extern "C" Datum file_open (PG_FUNCTION_ARGS)
> {
>  char *szName =3D PG_GETARG_CSTRING(0);
>  long lgLength =3D strlen(szName);

Type TEXT is not the same as a C string.  Look at the builtin functions
that manipulate text arguments.
        regards, tom lane


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Uniqueness of rule, constraint, and trigger names
Next
From: "Josh Berkus"
Date:
Subject: Re: Uniqueness of rule, constraint, and trigger names