pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
5+ messages / 2 participants
[nested] [flat]
* pgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
@ 2018-03-05 22:39 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 5+ messages in thread
From: Alvaro Herrera @ 2018-03-05 22:39 UTC (permalink / raw)
To: pgsql-committers
Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
The LIKE INCLUDING ALL clause to CREATE TABLE intuitively indicates
cloning of extended statistics on the source table, but it failed to do
so. Patch it up so that it does. Also include an INCLUDING STATISTICS
option to the LIKE clause, so that the behavior can be requested
individually, or excluded individually.
While at it, reorder the INCLUDING options, both in code and in docs, in
alphabetical order which makes more sense than feature-implementation
order that was previously used.
Backpatch this to Postgres 10, where extended statistics were
introduced, because this is seen as an oversight in a fresh feature
which is better to get consistent from the get-go instead of changing
only in pg11.
In pg11, comments on statistics objects are cloned too. In pg10 they
are not, because I (Álvaro) was too coward to change the parse node as
required to support it. Also, in pg10 I chose not to renumber the
parser symbols for the various INCLUDING options in LIKE, for the same
reason. Any corresponding user-visible changes (docs) are backpatched,
though.
Reported-by: Stephen Froehlich
Author: David Rowley
Reviewed-by: Álvaro Herrera, Tomas Vondra
Discussion: https://postgr.es/m/CY1PR0601MB1927315B45667A1B679D0FD5E5EF0@CY1PR0601MB1927.namprd06.prod.outlook.c...
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/911e6236bab5b1c2240c087e5e8a110acdb724ba
Modified Files
--------------
doc/src/sgml/ref/create_table.sgml | 8 +-
src/backend/commands/indexcmds.c | 5 +-
src/backend/commands/statscmds.c | 163 ++++++++++++++++++++----
src/backend/parser/gram.y | 5 +-
src/backend/parser/parse_utilcmd.c | 134 +++++++++++++++++++
src/include/nodes/parsenodes.h | 1 +
src/test/regress/expected/create_table_like.out | 9 ++
src/test/regress/sql/create_table_like.sql | 3 +
8 files changed, 296 insertions(+), 32 deletions(-)
^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
@ 2018-03-05 22:39 Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 1 reply; 5+ messages in thread
From: Alvaro Herrera @ 2018-03-05 22:39 UTC (permalink / raw)
To: pgsql-committers
Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
The LIKE INCLUDING ALL clause to CREATE TABLE intuitively indicates
cloning of extended statistics on the source table, but it failed to do
so. Patch it up so that it does. Also include an INCLUDING STATISTICS
option to the LIKE clause, so that the behavior can be requested
individually, or excluded individually.
While at it, reorder the INCLUDING options, both in code and in docs, in
alphabetical order which makes more sense than feature-implementation
order that was previously used.
Backpatch this to Postgres 10, where extended statistics were
introduced, because this is seen as an oversight in a fresh feature
which is better to get consistent from the get-go instead of changing
only in pg11.
In pg11, comments on statistics objects are cloned too. In pg10 they
are not, because I (Álvaro) was too coward to change the parse node as
required to support it. Also, in pg10 I chose not to renumber the
parser symbols for the various INCLUDING options in LIKE, for the same
reason. Any corresponding user-visible changes (docs) are backpatched,
though.
Reported-by: Stephen Froehlich
Author: David Rowley
Reviewed-by: Álvaro Herrera, Tomas Vondra
Discussion: https://postgr.es/m/CY1PR0601MB1927315B45667A1B679D0FD5E5EF0@CY1PR0601MB1927.namprd06.prod.outlook.c...
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5564c11815486bdfe87eb46ebc7c070293fa6956
Modified Files
--------------
doc/src/sgml/ref/create_table.sgml | 8 +-
src/backend/commands/indexcmds.c | 5 +-
src/backend/commands/statscmds.c | 169 ++++++++++++++++++++----
src/backend/nodes/copyfuncs.c | 1 +
src/backend/nodes/equalfuncs.c | 1 +
src/backend/nodes/outfuncs.c | 1 +
src/backend/parser/gram.y | 7 +-
src/backend/parser/parse_utilcmd.c | 143 ++++++++++++++++++++
src/include/nodes/parsenodes.h | 12 +-
src/test/regress/expected/create_table_like.out | 10 ++
src/test/regress/sql/create_table_like.sql | 3 +
11 files changed, 323 insertions(+), 37 deletions(-)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
@ 2018-03-06 02:08 Thomas Munro <thomas.munro@enterprisedb.com>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Munro @ 2018-03-06 02:08 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers
On Tue, Mar 6, 2018 at 11:39 AM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
Is this commit responsible for this valgrind error?
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lousyjack&dt=2018-03-05%2023%3A03%3A01
==430== Invalid read of size 2
==430== at 0x4C33F6F: memcpy@GLIBC_2.2.5 (vg_replace_strmem.c:1021)
==430== by 0x483419: heap_fill_tuple (heaptuple.c:276)
==430== by 0x4842C6: heap_form_tuple (heaptuple.c:771)
==430== by 0x6474B5: CreateStatistics (statscmds.c:322)
==430== by 0x865784: ProcessUtilitySlow (utility.c:1668)
==430== by 0x8642A2: standard_ProcessUtility (utility.c:935)
==430== by 0x863347: ProcessUtility (utility.c:358)
==430== by 0x862498: PortalRunUtility (pquery.c:1178)
==430== by 0x86268F: PortalRunMulti (pquery.c:1324)
==430== by 0x861BFD: PortalRun (pquery.c:799)
==430== by 0x85B947: exec_simple_query (postgres.c:1120)
==430== by 0x85FEE6: PostgresMain (postgres.c:4144)
==430== by 0x7CA783: BackendRun (postmaster.c:4412)
==430== by 0x7C9E6D: BackendStartup (postmaster.c:4084)
==430== by 0x7C635B: ServerLoop (postmaster.c:1757)
==430== by 0x7C58F0: PostmasterMain (postmaster.c:1365)
==430== by 0x702B56: main (main.c:228)
==430== Address 0x994d5ce is 14 bytes inside a block of size 15 client-defined
==430== at 0x9FA33A: palloc (mcxt.c:858)
==430== by 0x5EBE0C: downcase_identifier (scansup.c:146)
==430== by 0x5EBDE3: downcase_truncate_identifier (scansup.c:133)
==430== by 0x5B6E51: core_yylex (scan.l:1000)
==430== by 0x5B9F65: base_yylex (parser.c:101)
==430== by 0x589F45: base_yyparse (gram.c:24973)
==430== by 0x5B9EBF: raw_parser (parser.c:53)
==430== by 0x85B112: pg_parse_query (postgres.c:616)
==430== by 0x85B5C1: exec_simple_query (postgres.c:942)
==430== by 0x85FEE6: PostgresMain (postgres.c:4144)
==430== by 0x7CA783: BackendRun (postmaster.c:4412)
==430== by 0x7C9E6D: BackendStartup (postmaster.c:4084)
==430== by 0x7C635B: ServerLoop (postmaster.c:1757)
==430== by 0x7C58F0: PostmasterMain (postmaster.c:1365)
==430== by 0x702B56: main (main.c:228)
==430==
--
Thomas Munro
http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
@ 2018-03-06 02:53 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Thomas Munro <thomas.munro@enterprisedb.com>
0 siblings, 1 reply; 5+ messages in thread
From: Alvaro Herrera @ 2018-03-06 02:53 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: pgsql-hackers@postgresql.org
Thomas Munro wrote:
> On Tue, Mar 6, 2018 at 11:39 AM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> > Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
>
> Is this commit responsible for this valgrind error?
>
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lousyjack&dt=2018-03-05%2023%3A03%3A01
>
> ==430== Invalid read of size 2
> ==430== at 0x4C33F6F: memcpy@GLIBC_2.2.5 (vg_replace_strmem.c:1021)
> ==430== by 0x483419: heap_fill_tuple (heaptuple.c:276)
> ==430== by 0x4842C6: heap_form_tuple (heaptuple.c:771)
> ==430== by 0x6474B5: CreateStatistics (statscmds.c:322)
> ==430== by 0x865784: ProcessUtilitySlow (utility.c:1668)
Uh ... it probably is. I'll take a look tomorrow, but my guess is that
my last minute removal of the conversion to Name is to blame.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
@ 2018-03-06 16:23 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 5+ messages in thread
From: Alvaro Herrera @ 2018-03-06 16:23 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: pgsql-hackers@postgresql.org
Alvaro Herrera wrote:
> Thomas Munro wrote:
> > On Tue, Mar 6, 2018 at 11:39 AM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> > > Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL)
> >
> > Is this commit responsible for this valgrind error?
> >
> > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lousyjack&dt=2018-03-05%2023%3A03%3A01
> Uh ... it probably is. I'll take a look tomorrow, but my guess is that
> my last minute removal of the conversion to Name is to blame.
I was right about the cause. Fix pushed. Thanks for notifying.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-03-06 16:23 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-05 22:39 pgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL) Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-06 02:08 ` Thomas Munro <thomas.munro@enterprisedb.com>
2018-03-06 02:53 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-06 16:23 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-05 22:39 pgsql: Clone extended stats in CREATE TABLE (LIKE INCLUDING ALL) Alvaro Herrera <alvherre@alvh.no-ip.org>
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