BUG #13489: pg_attribute.attndims turns to 0 when 'create table like/as'
| От | sshang@pivotal.io |
|---|---|
| Тема | BUG #13489: pg_attribute.attndims turns to 0 when 'create table like/as' |
| Дата | |
| Msg-id | 20150707072942.1186.98151@wrigleys.postgresql.org обсуждение исходный текст |
| Список | pgsql-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)
В списке pgsql-bugs по дате отправления: