BUG #13489: pg_attribute.attndims turns to 0 when 'create table like/as'

From: sshang(at)pivotal(dot)io
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13489: pg_attribute.attndims turns to 0 when 'create table like/as'
Date: 2015-07-07 07:29:42
Message-ID: 20150707072942.1186.98151@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: 13489
Logged by: sshang
Email address: sshang(at)pivotal(dot)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)

Browse pgsql-bugs by date

  From Date Subject
Next Message olivier.gosseaume 2015-07-07 07:55:50 Re: BUG #13484: Performance problem with logical decoding
Previous Message Michael Paquier 2015-07-07 06:53:58 Re: contribcheck and modulescheck of MSVC's vcregress.pl cannot work independently