Re: Interesting CREATE TABLE AS misbehavior

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Interesting CREATE TABLE AS misbehavior
Date: 2006-09-18 13:30:43
Message-ID: 20060918133043.GA24675@kenobi.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> The reason for this behavior is that analyze.c attaches the CREATE TABLE
> AS aliases to the targetlist (via applyColumnNames) before it processes
> the ORDER BY clause. (So, "order by z2" works instead.) This seems
> like a bug: one would expect that the aliases do not change the
> semantics of the SELECT part of the command.

I'd tend to agree that it seems like a bug but I'm a little mystified as
to why an 'order by' would be desired (or allowed) for a 'create table as'
at all. Allowing it seems to imply it has some meaning.

Just my 2c,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-09-18 13:34:26 Re: [HACKERS] Developer's Wiki
Previous Message Gregory Stark 2006-09-18 13:26:31 Limited Sort