CREATE TABLE LIKE including all not including storage parameters?

From: Milen Blagojevic <milen(dot)blagojevic(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: CREATE TABLE LIKE including all not including storage parameters?
Date: 2017-09-05 08:56:37
Message-ID: CAG9ZzVZ6X=vw98ieZ86-x80g46aSyqCMTs7H5P6h0XmVS4-Utg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I am using CREATE TABLE LIKE for creating partitions :

Lets say this is my main table:

\d+ test_tabl
Table "public.test_tabl"
Column | Type | Modifiers | Storage | Stats
target | Description
--------------+-----------------------------+-----------+---
-------+--------------+-------------
id | integer | not null | plain |
|
test_name | character varying(10) | | extended |
|
test_value | numeric(19,3) | | main |
|
time_created | timestamp without time zone | | plain |
|
Indexes:
"test_tabl_pkey" PRIMARY KEY, btree (id)
"ix_test_tabl_time_created" btree (time_created)
Child tables: test_tabl_20170905
Options: fillfactor=75

I am creating new partitions with following query:

create table test_tabl_20170906 (like test_tabl INCLUDING ALL) inherits
(test_tabl);

\d+ test_tabl_20170906
Table "public.test_tabl_20170906"
Column | Type | Modifiers | Storage | Stats
target | Description
--------------+-----------------------------+-----------+---
-------+--------------+-------------
id | integer | not null | plain |
|
test_name | character varying(10) | | extended |
|
test_value | numeric(19,3) | | main |
|
time_created | timestamp without time zone | | plain |
|
Indexes:
"test_tabl_20170906_pkey" PRIMARY KEY, btree (id)
"test_tabl_20170906_time_created_idx" btree (time_created)
Inherits: test_tabl

According to PostgreSQL documentation:
INCLUDING ALL is an abbreviated form of INCLUDING DEFAULTS INCLUDING
CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS.

But in this case child table didn't inherit filfactor (behaviour is the
same for autovacuum parameters)

Version is 9.4.13:
version
------------------------------------------------------------
----------------------------------------------------
PostgreSQL 9.4.13 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-11), 64-bit

Am I doing something wrong here?

Thanks in advance.

Regards,
Milen Blagojevic

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2017-09-05 09:45:13 Re: CREATE TABLE LIKE including all not including storage parameters?
Previous Message Glen Huang 2017-09-05 06:53:11 Not possible to compare regrole in a view query?