Re: composite type insert

From: Ron Peterson <ron(dot)peterson(at)yellowbank(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: composite type insert
Date: 2006-11-19 16:34:19
Message-ID: 20061119163419.GB18326@yellowbank.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Nov 19, 2006 at 02:09:11AM -0500, Tom Lane wrote:
> Ron Peterson <ron(dot)peterson(at)yellowbank(dot)com> writes:
> > How should I create a composite type value out of columns a and b in
> > table tt that I can insert into table atable?
>
> Hm, it works for me with an explicit cast:
>
> INSERT INTO
> atable
> SELECT
> ROW(a, b)::atype
> FROM
> tt;
>
> Perhaps we should allow this in an automatic or even implicit cast
> context.

Ah, I can certainly live with a cast. I didn't realize that creating a
composite type with 'create type' also automatically created a cast. I
should have at least tried that. Maybe section 8.11 (Composite Types)
or the 'CREATE TYPE' section of the docs should mention this?

Best.

--
Ron Peterson
https://www.yellowbank.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2006-11-19 20:12:38 Re: Running a query as a specific, different user
Previous Message Mark Lubratt 2006-11-19 16:10:15 Running a query as a specific, different user