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

From Michael Fuhr
Subject Re: inserting values into types
Date
Msg-id 20041201001711.GA87131@winnie.fuhr.org
Whole thread Raw
In response to inserting values into types  ("Andrew Thorley" <andrew.thorley@linuxmail.org>)
List 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/


pgsql-sql by date:

Previous
From: "Andrew Thorley"
Date:
Subject: inserting values into types
Next
From: Christoph Haller
Date:
Subject: SET AUTOCOMMIT TO OFF