Re: [HACKERS] Interesting CREATE TABLE AS misbehavior

2006-09-18 Thread Stephen Frost
* Tom Lane ([EMAIL PROTECTED]) 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

Re: [HACKERS] Interesting CREATE TABLE AS misbehavior

2006-09-18 Thread Tom Lane
Stephen Frost [EMAIL PROTECTED] writes: 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. By that logic we should disallow CLUSTER,

Re: [HACKERS] Interesting CREATE TABLE AS misbehavior

2006-09-18 Thread Jim C. Nasby
On Mon, Sep 18, 2006 at 09:30:43AM -0400, Stephen Frost wrote: * Tom Lane ([EMAIL PROTECTED]) 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

[HACKERS] Interesting CREATE TABLE AS misbehavior

2006-09-17 Thread Tom Lane
regression=# select * from int8_tbl union all select * from int8_tbl order by q2; q1|q2 --+--- 4567890123456789 | -4567890123456789 4567890123456789 | -4567890123456789 4567890123456789 | 123 4567890123456789 |

Re: [HACKERS] Interesting CREATE TABLE AS misbehavior

2006-09-17 Thread Jim C. Nasby
On Sun, Sep 17, 2006 at 10:10:52PM -0400, Tom Lane wrote: I'm inclined to fix this in HEAD but not back-patch it, on the grounds that there might be apps out there expecting the existing behavior, and it's not a big enough deal to change behavior in a minor release. Thoughts? Isn't the