Re: Array OUT columns in a record returned from a function - Mailing list pgsql-general

From Tom Lane
Subject Re: Array OUT columns in a record returned from a function
Date
Msg-id 25355.1170803249@sss.pgh.pa.us
Whole thread Raw
In response to Array OUT columns in a record returned from a function  (Ged <pgsql4gm@gmail.com>)
List pgsql-general
Ged <pgsql4gm@gmail.com> writes:
> SELECT
>     q.id, q.name, q.summary, q.instructions, q.experience, q.notes,
> q.starts, q.ends
> ,    q.stage, st.description
> ,    q.series, r.name
> ,    COALESCE('../zones/' || q.zone, '../instances/' || q.instance)
> ,    COALESCE(z.name, i.name)
> INTO
>     results.id
> ,    results.name
> ,       results.summary
> ,       results.instructions
> ,       results.experience
> ,       results.notes
> ,    results.starts[0]
> ,       results.ends
> ,       results.stage
> ,       results.warning
> ,       results.series
> ,       results.series_name
> ,       results.location
> ,       results.location_name
> FROM

I don't think an INTO target can be anything except a simple variable or
simple record field.  So the [0] is taken as part of the SQL query
rather than part of an INTO target, and it goes downhill from there.

Consider assigning that value to a temp variable and then assigning
into the desired result format.

            regards, tom lane

pgsql-general by date:

Previous
From: Jeff Amiel
Date:
Subject: pg_dump/restore and functions/triggers/trigger functions
Next
From: Jeff Amiel
Date:
Subject: Re: pg_dump/restore and functions/triggers/trigger functions