Thread: BUG #14113: LIKE INCLUDING STORAGE bug?

BUG #14113: LIKE INCLUDING STORAGE bug?

From
jdnelson@dyn.com
Date:
The following bug has been logged on the website:

Bug reference:      14113
Logged by:          Jon Nelson
Email address:      jdnelson@dyn.com
PostgreSQL version: 9.4.6
Operating system:   Linux
Description:

Running 9.4.6 and 9.4.7, I think I have encountered a bug with INCLUDING
STORAGE.

The CREATE TABLE syntax with INCLUDING STORAGE would seem to suggest that
storage options on the parent table (such as fillfactor) are copied to the
new child table, but this doesn't appear to work:

jnelson=# create table p (column1 integer not null) with (fillfactor = 70);
CREATE TABLE
jnelson=# \d+ p
                           Table "public.p"
 Column  |  Type   | Modifiers | Storage | Stats target | Description
---------+---------+-----------+---------+--------------+-------------
 column1 | integer | not null  | plain   |              |
Options: fillfactor=70

jnelson=# create table c (like p including storage);
CREATE TABLE
jnelson=# \d+ c
                           Table "public.c"
 Column  |  Type   | Modifiers | Storage | Stats target | Description
---------+---------+-----------+---------+--------------+-------------
 column1 | integer | not null  | plain   |              |

jnelson=#

Re: BUG #14113: LIKE INCLUDING STORAGE bug?

From
"David G. Johnston"
Date:
On Monday, April 25, 2016, <jdnelson@dyn.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14113
> Logged by:          Jon Nelson
> Email address:      jdnelson@dyn.com <javascript:;>
> PostgreSQL version: 9.4.6
> Operating system:   Linux
> Description:
>
> Running 9.4.6 and 9.4.7, I think I have encountered a bug with INCLUDING
> STORAGE.
>
> The CREATE TABLE syntax with INCLUDING STORAGE would seem to suggest that
> storage options on the parent table (such as fillfactor) are copied to the
> new child table, but this doesn't appear to work:
>
> jnelson=# create table p (column1 integer not null) with (fillfactor = 70);
> CREATE TABLE
> jnelson=# \d+ p
>                            Table "public.p"
>  Column  |  Type   | Modifiers | Storage | Stats target | Description
> ---------+---------+-----------+---------+--------------+-------------
>  column1 | integer | not null  | plain   |              |
> Options: fillfactor=70
>
> jnelson=# create table c (like p including storage);
> CREATE TABLE
> jnelson=# \d+ c
>                            Table "public.c"
>  Column  |  Type   | Modifiers | Storage | Stats target | Description
> ---------+---------+-----------+---------+--------------+-------------
>  column1 | integer | not null  | plain   |              |
>
> jnelson=#
>
>
This is intended, though your confusion is understandable.

As noted explicitly in the inherits section, and repeatedly qualified
within like, the things being copied are columns and stuff related to
them.  Fillfactor is a table-scoped property and thus is not copied.

The relevant link in the like section directs the user to the chapter on
TOAST, which I believe is the only form of column storage customization
available to the DBA.

David J,