BUG #10674: syntax error with CREATE TABLE table AS SELECT (column1, column 2) FROM table2

From: professor(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #10674: syntax error with CREATE TABLE table AS SELECT (column1, column 2) FROM table2
Date: 2014-06-16 22:03:46
Message-ID: 20140616220346.2586.475@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 10674
Logged by: Todd Sedano
Email address: professor(at)gmail(dot)com
PostgreSQL version: 9.3.3
Operating system: Mac OS 10.8.5
Description:

Note: I feel like I must be doing something wrong, but I've been able to
reproduce this in two very different environments.

The following SQL is valid postgres, see
http://www.postgresql.org/docs/9.3/static/sql-createtableas.html
"CREATE TABLE retail_demo.imported_table AS SELECT (column1, column2) FROM
retail_demo.external_table;"

However, it generates the odd message "ERROR: column "row" has pseudo-type
record"

We were able to get around this issue, by removing the () around (column1,
column2)
"CREATE TABLE retail_demo.imported_table AS SELECT column1, column2 FROM
retail_demo.external_table;"

This is reproducible with this sequence....

create table source_table (column1 text, column2 text, column3 text);
insert into source_table values ('value 1', 'value 2', 'value 3');
create table destination_table AS SELECT (column1, column2) from
source_table;
ERROR: column "row" has pseudo-type record
create table destination_table AS SELECT column1, column2 from source_table;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-06-16 23:29:36 Re: BUG #10667: [9.2.4] Incorrect output for query involving where clause with coalesce
Previous Message Kevin Grittner 2014-06-16 20:30:40 Re: BUG #10667: [9.2.4] Incorrect output for query involving where clause with coalesce