pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yasir Malik <ymalik@cs.stevens-tech.edu>
To: PostgreSQL <pgsql-sql@postgresql.org>
Subject: Re: inserting values into types
Date: Sat, 4 Dec 2004 23:13:29 -0500 (EST)
Message-ID: <Pine.NEB.4.60.0412042310560.7853@dab.cs.stevens-tech.edu> (raw)
In-Reply-To: <20041201234311.L622@hermes.hilbert.loc>
References: <20041201215811.476CF23CE8@ws5-3.us4.outblaze.com>
	<20041201234311.L622@hermes.hilbert.loc>

>> 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



view thread (8+ messages)  latest in thread

Message-ID: <Pine.NEB.4.60.0412042310560.7853@dab.cs.stevens-tech.edu>
Permalink:  ../Pine.NEB.4.60.0412042310560.7853@dab.cs.stevens-tech.edu/
Also on:    postgresql.org/message-id/Pine.NEB.4.60.0412042310560.7853@dab.cs.stevens-tech.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ymalik@cs.stevens-tech.edu
  Subject: Re: inserting values into types
  In-Reply-To: <Pine.NEB.4.60.0412042310560.7853@dab.cs.stevens-tech.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox