From: Tom Lane <tgl@sss.pgh.pa.us>
To: Céline Rivière <cr@fr.netcentrex.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: CREATE FUNCTION and LANGUAGE 'C'
Date: Mon, 04 Mar 2002 17:58:22 -0500
Message-ID: <8828.1015282702@sss.pgh.pa.us> (raw)
In-Reply-To: <0b7c01c1c06e$d687e3d0$c7a638d5@fr.netcentrex.net>
References: <0b7c01c1c06e$d687e3d0$c7a638d5@fr.netcentrex.net>
=?iso-8859-1?Q?C=E9line_Rivi=E8re?= <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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, cr@fr.netcentrex.net
Subject: Re: CREATE FUNCTION and LANGUAGE 'C'
In-Reply-To: <8828.1015282702@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox