Re: Select + Functions + Composite Types: Behavior

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select + Functions + Composite Types: Behavior
Date: 2011-02-13 00:08:48
Message-ID: 01eb01cbcb12$3064bfb0$912e3f10$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Another similar situation that I'll bring here first:

I want to do:

SELECT createdid, eventresult
FROM createvehiclesaleimport() er
INTO targetid, evtresult;

But this gives a function compilation error: ' "evtresult" is not a scalar
variable '

createdid/targeted are boolean
eventresult/evtresult are CompositeType

createvehiclesaleimport() returns (Boolean, CompositeType)

I can do:

SELECT createdid, (eventresult).prop1, (eventresult).prop2
FROM createvehiclesaleimport() er
INTO targetid, evtresult.prop1, evtresult.prop2

(with or without the 'er' alias)

What's the magic syntax to allow me to chain "eventresult/evtresult" without
having to explicitly address it's scalar components. This is different than
the other situation in that the called function now returns both a scalar as
well as a composite type whereas the other behavior occurred when the sole
output for the called function was a compositetype.

9.0.3/plpgsql

Thanks.

David J

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ruben Blanco 2011-02-13 01:11:52 Heavy queries not run by user application
Previous Message David Johnston 2011-02-12 23:49:36 Re: Select + Functions + Composite Types: Behavior