Re: inserting values into types - Mailing list pgsql-sql

From Yasir Malik
Subject Re: inserting values into types
Date
Msg-id Pine.NEB.4.60.0412042310560.7853@dab.cs.stevens-tech.edu
Whole thread Raw
In response to Re: inserting values into types  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: inserting values into types
Making dirty reads possible?
List 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 by date:

Previous
From: Kretschmer Andreas
Date:
Subject: Re: sum query
Next
From: Michael Fuhr
Date:
Subject: Re: inserting values into types