Re: Got error on CREATE TABLE AS (+Bug?)

From: "Command Prompt, Inc(dot)" <pgsql-general(at)commandprompt(dot)com>
To: Jeff Lu <jklcom(at)mindspring(dot)com>
Cc: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Got error on CREATE TABLE AS (+Bug?)
Date: 2001-11-04 23:35:17
Message-ID: Pine.LNX.4.30.0111041532180.19169-100000@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 4 Nov 2001, Command Prompt, Inc. wrote:
>I don't believe you can specify types or constraints. Also, if you specify
>the name of each column in parens, PostgreSQL seems to get confused if you
>do a SELECT * following AS, rather than specify each table name as well
>(as of 7.1.x, I get ERROR: CREATE TABLE/AS SELECT has mismatched column
>count - is this a known bug?)

Er, make that "column name" above, not "table name". Here's an example of
what I was trying to describe:

lx=# CREATE TABLE abc (a char, b char, c char);
CREATE
lx=# CREATE TABLE xyz (x, y, z) AS SELECT * FROM abc;
ERROR: CREATE TABLE/AS SELECT has mismatched column count
lx=# CREATE TABLE xyz (x, y, z) AS SELECT a, b, c FROM abc;
SELECT

You can explicitly provide each column name in the AS SELECT clause, and
that appears to work properly, but supplying a "*" confuses the backend.

Is this as it should be, or is it a known issue?

Regards,
Jw.
--
jlx(at)commandprompt(dot)com
by way of pgsql-general(at)commandprompt(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Lu 2001-11-04 23:35:59 Is there an internal timestamp on a table when it was created?
Previous Message Command Prompt, Inc. 2001-11-04 23:30:47 Re: Got error on CREATE TABLE AS (+Bug?)