Re: ask for parts of a user defined types - Mailing list pgsql-novice

From Tom Lane
Subject Re: ask for parts of a user defined types
Date
Msg-id 21935.1113324577@sss.pgh.pa.us
Whole thread Raw
In response to ask for parts of a user defined types  (Kjetil Haaland <kjetil.haaland@student.uib.no>)
List pgsql-novice
Kjetil Haaland <kjetil.haaland@student.uib.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

pgsql-novice by date:

Previous
From: Kjetil Haaland
Date:
Subject: ask for parts of a user defined types
Next
From: "Keith Worthington"
Date:
Subject: Using an SRF with VB6