Re: inserting values into types

Поиск
Список
Период
Сортировка
От Yasir Malik
Тема Re: inserting values into types
Дата
Msg-id Pine.NEB.4.60.0412042310560.7853@dab.cs.stevens-tech.edu
обсуждение исходный текст
Ответ на Re: inserting values into types  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Ответы Re: inserting values into types
Making dirty reads possible?
Список pgsql-sql
>> CREATE TYPE qwerty_UDT AS (abc INT);
>>
>> CREATE TABLE t (col1 qwerty_UDT);
>>
>> INSERT INTO t (col1) VALUES (qwerty_UDT(123));
>>
>> ERROR:  function qwerty_udt(integer) does not exist
>> HINT:  No function matches the given name and argument types. You may need to add explicit type casts.

It seems as though you want to create your own user-defined types.  That 
isn't easy in PostgreSQL.  You have to create an external C struct and 
write a function to convert a PostgreSQL string to a C struct and return 
it to the database (called an input function), and create another function 
that takes an object from the database and returns a string to the 
database in order to print out the object (called an output function). 
The only thing PostgreSQL knows about the object is size of the object and 
the input and output functions.  You also need to be the database 
administrator.  Go here for more information:
http://www.postgresql.org/docs/current/static/xtypes.html

I had to create an object-oriented database for one of my classes, and 
although I wanted to use PostgreSQL, I didn't want to deal with so low 
level stuff.  Oracle is much better for object-oriented features.

Regards,
Yasir


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

Предыдущее
От: Kretschmer Andreas
Дата:
Сообщение: Re: sum query
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: inserting values into types