RE: [INTERFACES] pb when creating user type

Поиск
Список
Период
Сортировка
От Craig Orsinger
Тема RE: [INTERFACES] pb when creating user type
Дата
Msg-id XFMail.990503111819.orsingerc@epg-gw1.lewis.army.mil
обсуждение исходный текст
Ответ на pb when creating user type  ("abdelkrim" <haj@idianet.net>)
Ответы RE: [INTERFACES] pb when creating user type  (Craig Orsinger <orsingerc@epg-gw1.lewis.army.mil>)
Список pgsql-interfaces
On 03-May-99 abdelkrim wrote:
> hello
> I try to create a type complex, i generate a complex.so and when to insert
> one complex into a table i have some problems
> please help me
> 
> 
> CREATE FUNCTION complex_out(opaque)
>    RETURNS opaque
>    AS '/usr/local/pgsql/complex.so'
>    LANGUAGE 'c';
> CREATE
> 
> CREATE TYPE complex (
>    internallength = 16,
>    input = complex_in,
>    output = complex_out
> );
> CREATE
> 
> 
> CREATE TABLE test_complex (
>         a       complex,
>         b       complex
> );
> CREATE
> 
> INSERT INTO test_complex VALUES ('(1.0, 2.5)', '(4.2, 3.55 )');
> ERROR:  Can't find function complex_in in file /usr/local/pgsql/complex.so
> ERROR:  Can't find function complex_in in file /usr/local/pgsql/complex.so
> INSERT INTO test_complex VALUES ('(33.0, 51.4)', '(100.42, 93.55)');
> ERROR:  Can't find function complex_in in file /usr/local/pgsql/complex.so
> ERROR:  Can't find function complex_in in file /usr/local/pgsql/complex.so
       The first question that occurs to me is, what version of 
PostgreSQL are you trying this with, and on what operating system?
       Second question: How did you generate the "complex.so"
library? You need to turn it into a shared library, which generally
requires that you first compile using a position independent code
option. With GNU utilities, it would go something like this:
       gcc -c -g -fpic -o complex.o complex.c       ld -Bshareable -o complex.so complex.o 
       Then of course, you'll have to copy it to the /usr/local/pgsql
directory (since your installation script looks for it there), and you
may have to make sure that you have read AND execute permissions set.
HPUX requires this, and other OSs may, as well.
       As near as I can tell, the commands you listed should work,
provided you've installed per my directions. If that's not the problem
then we'll need more information, I suspect.

----------------------------------
Date: 03-May-99  Time: 11:06:27

Craig Orsinger                  (email: <orsingerc@epg.lewis.army.mil>)
Logicon RDA
Bldg. 8B28                      "Just another megalomaniac with ideas above his
6th & F Streets                 station. The Universe is full of them."
Ft. Lewis, WA   98433                   - The Doctor
----------------------------------


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: JT Kirkpatrick
Дата:
Сообщение: error message
Следующее
От: barreiro@arrakis.es
Дата:
Сообщение: Error linking C++ code.