Re: inserting values into types

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Andrew Thorley <andrew(dot)thorley(at)linuxmail(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: inserting values into types
Date: 2004-12-01 00:17:12
Message-ID: 20041201001711.GA87131@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Dec 01, 2004 at 07:51:17AM +0800, Andrew Thorley wrote:

> ive generated a user defined type: CREATE TYPE qwerty_UDT AS (abc INT);
>
> & table as: CREATE TABLE t (col1 qwerty_UDT);

Are you using 8.0? I don't think earlier versions allowed this.

> my prob is that when i try to insert into the type i.e: INSERT INTO t (col1) Values (qwerty_UDT(123));
>
> i get the error:
>
> ERROR: function test_x(integer) does not exist

This error doesn't agree with the INSERT statement you gave -- it
should say "function qwerty_udt(integer) does not exist". Where
does test_x() come from? Did you type the SQL statements and/or
error messages instead of cutting and pasting? We can see what's
happening, but it's better to paste the exact statements and output
to avoid mistakes.

> HINT: No function matches the given name and argument types. You may need to add explicit type casts.

See the "Composite Types" documentation -- it has a section entitled
"Composite Value Input":

http://developer.postgresql.org/docs/postgres/rowtypes.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Johan Henselmans 2004-12-01 05:57:54 Re: grouping a many to many relation set
Previous Message Andrew Thorley 2004-11-30 23:51:17 inserting values into types