pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sshang@pivotal.io
To: pgsql-bugs@postgresql.org
Subject: BUG #13489: pg_attribute.attndims turns to 0 when 'create table like/as'
Date: Tue, 07 Jul 2015 07:29:42 +0000
Message-ID: <20150707072942.1186.98151@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



Message-ID: <20150707072942.1186.98151@wrigleys.postgresql.org>
Permalink:  ../20150707072942.1186.98151@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20150707072942.1186.98151@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: sshang@pivotal.io
  Subject: Re: BUG #13489: pg_attribute.attndims turns to 0 when 'create table like/as'
  In-Reply-To: <20150707072942.1186.98151@wrigleys.postgresql.org>
  References: <20150707072942.1186.98151@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox