Search Postgresql Archives

user defined C-lang pg function bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux