Re: Array OUT columns in a record returned from a function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ged <pgsql4gm(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Array OUT columns in a record returned from a function
Date: 2007-02-06 23:07:29
Message-ID: 25355.1170803249@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ged <pgsql4gm(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Amiel 2007-02-06 23:07:49 Re: pg_dump/restore and functions/triggers/trigger functions
Previous Message Jeff Amiel 2007-02-06 22:56:17 pg_dump/restore and functions/triggers/trigger functions