Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCNLH-0003zd-0T for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Jul 2015 07:30:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZCNLG-0004Na-Gt for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Jul 2015 07:30:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZCNKQ-0003dP-MX for pgsql-bugs@postgresql.org; Tue, 07 Jul 2015 07:30:06 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZCNKO-0003YO-2W for pgsql-bugs@postgresql.org; Tue, 07 Jul 2015 07:30:06 +0000 MIME-Version: 1.0 Subject: BUG #13489: pg_attribute.attndims turns to 0 when 'create table like/as' To: pgsql-bugs@postgresql.org From: sshang@pivotal.io Date: Tue, 07 Jul 2015 07:29:42 +0000 Message-ID: <20150707072942.1186.98151@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13489 Logged by: sshang Email address: sshang@pivotal.io PostgreSQL version: 9.4.1 Operating system: centos 6 Description: When I create a table with array column, the pg_attribute.attndims will set to a non-zero value. Then I create another table using 'create like' or 'create as', the pg_attribute.attndims of the new table will turn to 0. postgres=# \d test1; Table "public.test1" Column | Type | Modifiers --------+-----------+----------- id | integer | datas | integer[] | d2 | integer[] | d3 | integer[] | postgres=# create table test2 (like test1); CREATE TABLE postgres=# \d test2; Table "public.test2" Column | Type | Modifiers --------+-----------+----------- id | integer | datas | integer[] | d2 | integer[] | d3 | integer[] | postgres=# select att.attname, att.attndims from pg_attribute att, pg_class c where c.relname='test1' and att.attrelid = c.oid; attname | attndims ----------+---------- tableoid | 0 cmax | 0 xmax | 0 cmin | 0 xmin | 0 ctid | 0 id | 0 datas | 1 d2 | 2 d3 | 3 postgres=# select att.attname, att.attndims from pg_attribute att, pg_class c where c.relname='test2' and att.attrelid = c.oid; attname | attndims ----------+---------- tableoid | 0 cmax | 0 xmax | 0 cmin | 0 xmin | 0 ctid | 0 id | 0 datas | 0 d2 | 0 d3 | 0 (10 rows) postgres=# create table test3 as select * from test1; SELECT 1 postgres=# \d test3; Table "public.test3" Column | Type | Modifiers --------+-----------+----------- id | integer | datas | integer[] | d2 | integer[] | d3 | integer[] | postgres=# select att.attname, att.attndims from pg_attribute att, pg_class c where c.relname='test3' and att.attrelid = c.oid; attname | attndims ----------+---------- tableoid | 0 cmax | 0 xmax | 0 cmin | 0 xmin | 0 ctid | 0 id | 0 datas | 0 d2 | 0 d3 | 0 (10 rows) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs