[SQL] Type Inheritance

2004-11-25 Thread Andrew Thorley
Does anyone know how to implement type inheritance in postgresql? in oracle you 
just use the word UNDER in ur code i.e:

CREATE TYPE test2_UDT UNDER test1_UDT AS (abc INT);

any ideas?

-- 
__
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


[SQL] tutorials for complex.sql & complex.c

2004-11-26 Thread Andrew Thorley
hi can anyone inform me where to get the postgreSQL complex.sql & complex.c 
tutorials from, cos i have no idea.

in the 7.4.2-A4 doc it says:

The examples in this section can be found in complex.sql and complex.c in the 
src/tutorial
directory of the source distribution. See the README file in that directory for 
instructions about running
the examples.

im still unsure, where to look. can anyone solve my prob?



-- 
__
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [SQL] Type Inheritance

2004-11-27 Thread Andrew Thorley
hi tom thanks for reply.

im trying to provide inheritance for data types (domains), not tables. i will 
look into the syntax associated with domains as data types does not include an 
inheritance function (or so i think).

regards andy.


- Original Message -
From: "Tom Lane" <[EMAIL PROTECTED]>
To: "Andrew Thorley" <[EMAIL PROTECTED]>
Subject: Re: [SQL] Type Inheritance 
Date: Fri, 26 Nov 2004 13:14:07 -0500

> 
> "Andrew Thorley" <[EMAIL PROTECTED]> writes:
> > Does anyone know how to implement type inheritance in postgresql? in oracle 
> > you just use the word UNDER in ur code i.e:
> > CREATE TYPE test2_UDT UNDER test1_UDT AS (abc INT);
> 
> If you had said what this *does*, we might be better able to help.
> 
> But take a look at CREATE DOMAIN, as well as the INHERITS and LIKE
> options in CREATE TABLE.  Some part of that might be close to what
> you are looking for.
> 
>   regards, tom lane
> 
> ---(end of broadcast)---
> TIP 9: the planner will ignore your desire to choose an index scan if your
>   joining column's datatypes do not match
> 

-- 
__
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [SQL] Type Inheritance

2004-11-27 Thread Andrew Thorley
"If you had said what this *does*, we might be better able to help"

basically i have a series of types (or data types), of which one is the root 
and each of the other types appear under the root as in 
generalisation/specialisation style, inheriting the above types attributes etc. 
this is what im trying to achieve, although at present, to no avail :(


- Original Message -----
From: "Andrew Thorley" <[EMAIL PROTECTED]>
To: "Tom Lane" <[EMAIL PROTECTED]>
Subject: Re: [SQL] Type Inheritance
Date: Sat, 27 Nov 2004 22:04:55 +0800

> 
> hi tom thanks for reply.
> 
> im trying to provide inheritance for data types (domains), not tables. i will 
> look into the syntax associated with domains as data types does not include 
> an inheritance function (or so i think).
> 
> regards andy.
> 
> 
> - Original Message -
> From: "Tom Lane" <[EMAIL PROTECTED]>
> To: "Andrew Thorley" <[EMAIL PROTECTED]>
> Subject: Re: [SQL] Type Inheritance 
> Date: Fri, 26 Nov 2004 13:14:07 -0500
> 
> > 
> > "Andrew Thorley" <[EMAIL PROTECTED]> writes:
> > > Does anyone know how to implement type inheritance in postgresql? in 
> > > oracle you just use the word UNDER in ur code i.e:
> >

 > CREATE TYPE test2_UDT UNDER test1_UDT AS (abc INT);
> > 
> > If you had said what this *does*, we might be better able to help.
> > 
> > But take a look at CREATE DOMAIN, as well as the INHERITS and LIKE
> > options in CREATE TABLE.  Some part of that might be close to what
> > you are looking for.
> > 
> > regards, tom lane
> > 
> > ---(end of broadcast)---
> > TIP 9: the planner will ignore your desire to choose an index scan if your
> >   joining column's datatypes do not match
> > 
> 
> -- 
> __
> Check out the latest SMS services @ http://www.linuxmail.org 
> This allows you to send and receive SMS through your mailbox.
> 
> 
> Powered by Outblaze
> 
> ---(end of broadcast)---
> TIP 8: explain analyze is your friend
> 

-- 
__
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


[SQL] inserting values into types

2004-11-30 Thread Andrew Thorley
Hi,

ive generated a user defined type: CREATE TYPE qwerty_UDT AS (abc INT);

& table as: CREATE TABLE t (col1 qwerty_UDT);

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
HINT:  No function matches the given name and argument types. You may need to 
add explicit type casts.

which is quite confusing, does anyone have any ideas or exp with this scenario, 
or offer help in any way?

ty in advance :)
-- 
__
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [SQL] inserting values into types

2004-12-01 Thread Andrew Thorley
hi mike,

sorry for confusion, the test_x is my mistake, its from another type i created 
which is executing the same code.

my error i get from:

CREATE TYPE qwerty_UDT AS (abc INT);

CREATE TABLE t (col1 qwerty_UDT);

INSERT INTO t (col1) VALUES (qwerty_UDT(123));


is:

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.





- Original Message -
From: "Michael Fuhr" <[EMAIL PROTECTED]>
To: "Andrew Thorley" <[EMAIL PROTECTED]>
Subject: Re: [SQL] inserting values into types
Date: Wed, 1 Dec 2004 10:53:01 -0700

> 
> On Wed, Dec 01, 2004 at 06:07:34PM +0800, Andrew Thorley wrote:
> 
> > > Did you type the SQL statements and/or error messages instead
> > > of cutting and pasting?
> >
> > yes i C&P'ed the SQL code & error code.
> 
> But did you copy the error message associated with the SQL code you
> copied, or did you copy some other error message?  I ask because
> the function name in the error doesn't match the function name in
> the INSERT statement.  Here's what I get when I execute the statements
> in your message:
> 
> test=> CREATE TYPE qwerty_UDT AS (abc INT);
> CREATE TYPE
> test=> CREATE TABLE t (col1 qwerty_UDT);
> CREATE TABLE
> test=> INSERT INTO t (col1) Values (qwerty_UDT(123));
> ERROR:  function qwerty_udt(integer) does not exist
> 
> You said the error you got was:
> 
> ERROR:  function test_x(integer) does not exist
> 
> The error is the same but the detail differs: your error refers
> to test_x(integer) instead of qwerty_udt(integer).  So where is
> test_x coming from?
> 
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/

-- 
__
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match