Received: from glass.pun-pun.prv (IDENT:root@ip12.dialup9.tokyo.jp.psi.net [154.33.243.12]) by hub.org (8.10.1/8.10.1) with ESMTP id e93Fpsr16593 for ; Tue, 3 Oct 2000 11:51:55 -0400 (EDT) Received: from localhost (devin@localhost) by glass.pun-pun.prv (8.9.3/8.9.3) with ESMTP id AAA02044; Wed, 4 Oct 2000 00:51:40 +0900 X-Authentication-Warning: glass.pun-pun.prv: devin owned process doing -bs Date: Wed, 4 Oct 2000 00:51:37 +0900 (JST) From: Tod McQuillin X-Sender: devin@glass To: David Diller cc: pgsql-sql@postgresql.org Subject: Re: table as field type?? In-Reply-To: <3.0.3.32.20001003105948.00ae7a70@pobox1.bbn.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200010/28 On Tue, 3 Oct 2000, David Diller wrote: > I noticed that it's possible to have a table as a field type. > For example: > create table foo (val1 integer); > create table bar (val2 foo); > > val2 in table bar ends up as an int4, designed for storing an oid from > table foo. > Is there a way to perform a query on bar that will return values from table > foo (i.e., val1)? I didn't know you could use a table name as a type either. I thought something like this might join the tables: select val1 from foo, bar where bar.val2::oid = foo.oid ; But I get "ERROR: Cannot cast type 'foo' to 'oid'" You can't seem to cast an oid into a foo either. -- Tod McQuillin