| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: "Subquery must return only one column" & query optimization |
| Date: | 2008-12-15 13:17:57 |
| Message-ID: | 25704.1229347077@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
"Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch> writes:
> I was trying to run this query this morning:
> --------------------------
> SELECT
> r.*,
> (
> SELECT
> rl.reminder_header,
> rl.reminder_footer
> FROM reminder_levels AS rl
> WHERE rl.lookup =
> (
> SELECT MAX(reminder_level_lookup)
> FROM reminders
> WHERE customer_id = r.customer_id
> )
> )
> FROM reminders AS r
> --------------------------
> Postgresql replied that:
> --------------------------
> ERROR: subquery must return only one column
Since 8.0 or so you could write the sub-select as
SELECT ROW(rl.reminder_header, rl.reminder_footer) FROM ...
We ought to make that happen automatically, but it's not real
high on the to-do list.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Philippe Lang | 2008-12-15 14:21:41 | Re: "Subquery must return only one column" & query optimization |
| Previous Message | Philippe Lang | 2008-12-15 12:12:54 | "Subquery must return only one column" & query optimization |