Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 6CC74475A9D for ; Mon, 4 Mar 2002 17:58:28 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g24MwMS08831; Mon, 4 Mar 2002 17:58:22 -0500 (EST) To: =?iso-8859-1?Q?C=E9line_Rivi=E8re?= Cc: pgsql-sql@postgresql.org Subject: Re: CREATE FUNCTION and LANGUAGE 'C' In-reply-to: <0b7c01c1c06e$d687e3d0$c7a638d5@fr.netcentrex.net> References: <0b7c01c1c06e$d687e3d0$c7a638d5@fr.netcentrex.net> Comments: In-reply-to =?iso-8859-1?Q?C=E9line_Rivi=E8re?= message dated "Thu, 28 Feb 2002 16:44:42 +0100" Date: Mon, 04 Mar 2002 17:58:22 -0500 Message-ID: <8828.1015282702@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200203/50 X-Sequence-Number: 6932 =?iso-8859-1?Q?C=E9line_Rivi=E8re?= 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