Re: alter table add column - specify where the column will go?

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: alter table add column - specify where the column will go?
Date: 2010-11-24 14:54:21
Message-ID: eceaf1e4-e485-4cb2-b587-d1dfacd7ab93@mm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fredric Fredricson wrote:

> But if you change the column names in the second SELECT in the UNION this is
> ignored:
> # SELECT c1,c2 FROM (SELECT 1 AS c1, 2 AS c2 UNION SELECT 2 AS c3, 1 AS c4)
> AS x;
> c1 | c2
> ----+----
> 1 | 2
> 2 | 1
> Apparently, in a UNION the column names are derived from the first statement
> only.

The example upthread demonstrates that in certain contexts, column positions
are relevant whereas column names are not. The modified query you show here
doesn't lead to any different conclusion.

The allegation that row.* doesn't come with a deterministic column order
remains pretty much unsubstantiated at this point.

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message akp geek 2010-11-24 15:47:18 Postgres 9 and postgis1.5.2
Previous Message Fredric Fredricson 2010-11-24 13:12:37 Re: alter table add column - specify where the column will go?