Re: ask for parts of a user defined types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kjetil Haaland <kjetil(dot)haaland(at)student(dot)uib(dot)no>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: ask for parts of a user defined types
Date: 2005-04-12 16:49:37
Message-ID: 21935.1113324577@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Kjetil Haaland <kjetil(dot)haaland(at)student(dot)uib(dot)no> writes:
> I am wondering if it is possible to select values from user defined types.
> That is, if a new type is defined like for example the Complex type in the
> documentation, is it then possible to select just one of the double values
> that this type keeps?

Yes, but there are some syntactic issues that get in the way because
"foo.bar" is a table name and field name according to the SQL standard.

In PG >= 8.0 you can select a field from something that isn't a table
by parenthesizing; see the examples here:
http://www.postgresql.org/docs/8.0/static/rowtypes.html

In earlier versions you frequently have to fall back on the old PostQUEL
functional syntax: write bar(foo) where you mean foo.bar.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Keith Worthington 2005-04-12 18:38:56 Using an SRF with VB6
Previous Message Kjetil Haaland 2005-04-12 16:14:05 ask for parts of a user defined types