Re: CREATE FUNCTION and LANGUAGE 'C'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Céline Rivière <cr(at)fr(dot)netcentrex(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: CREATE FUNCTION and LANGUAGE 'C'
Date: 2002-03-04 22:58:22
Message-ID: 8828.1015282702@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

=?iso-8859-1?Q?C=E9line_Rivi=E8re?= <cr(at)fr(dot)netcentrex(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-03-04 23:03:16 Re: [INTERFACES] PL/pgSQL Syntax Problem
Previous Message Stephan Szabo 2002-03-04 22:51:16 Re: Uniqueness of rule, constraint, and trigger names