I could use a helpful suggestion or two as to why the following is
occuring or more to the matter, how I might work around it.  Certainly
appears to be a bug or some sort of misunderstanding on my part.

This has been tested on FreeBSD/i386 5.4 and postgres 8.1.3 as well as
Linux (2.4 kernel) and postgres 8.1.5.

Below is the issue:

CREATE OR REPLACE FUNCTION pg_test(text) RETURNS integer
   AS '/usr/local/lib/postgresql/pg_test', 'pg_test'
LANGUAGE C STRICT;

PG_FUNCTION_INFO_V1(pg_test);
Datum pg_test(PG_FUNCTION_ARGS) {
   text *a = PG_GETARG_TEXT_P(0);
   ereport(NOTICE,(errmsg("incoming text: %s", VARDATA(a))));
   PG_RETURN_INT32(1);
}

CREATE OR REPLACE FUNCTION pg_test(text) RETURNS integer
   AS '/usr/local/lib/postgresql/pg_test', 'pg_test'
LANGUAGE C STRICT;

postgres=> select pg_test('HELLO WORLD');
NOTICE:  incoming text: HELLO WORLD
pg_test
---------
      1
(1 row)

postgres=> select pg_test('STRANGE WORLD');
NOTICE:  incoming text: STRANGE WORLD4
pg_test
---------
      1
(1 row)

postgres=> select pg_test('HELLO WORLD');
NOTICE:  incoming text: HELLO WORLDLĂ 4
pg_test
---------
      1
(1 row)

The incoming text indicates there are extraneous characters making
there way in somehow.

James

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/

Reply via email to