pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: zhq651@126.com
Subject: BUG #16179: is it reasonable to callback pgss_post_parse_analyze or pg_hint_plan_post_parse_analyze ???
Date: Wed, 25 Dec 2019 08:31:24 +0000
Message-ID: <16179-f7f1d45afb4452bb@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16179
Logged by:          DamionZ Zhao
Email address:      zhq651@126.com
PostgreSQL version: 11.5
Operating system:   linux
Description:        

When I only configure GUC as shared_preload_libraries = 'pg_hint_plan,
pg_stat_statment'
and have not run sql: 'create extension pg_hint_plan;  create extension
pg_stat_statment',
I expected that parse_analyze will not run into functions
:pgss_post_parse_analyze or pg_hint_plan_post_parse_analyze

In fact , it does not .  I print runtime call stack.
-----------------------------------------------------
statment 1: select 
#0  pgss_post_parse_analyze (pstate=0x2a45818, query=0x2a45928) at
pg_stat_statements.c:812
#1  0x00007fbe60506734 in pg_hint_plan_post_parse_analyze (pstate=0x2a45818,
query=0x2a45928) at pg_hint_plan.c:2767
#2  0x000000000058fbe5 in parse_analyze (parseTree=0x2a45798,
sourceText=0x2a44a90 "select * from abcd;", paramTypes=0x0, numParams=0,
queryEnv=0x0) at analyze.c:124
#3  0x00000000008926b6 in pg_analyze_and_rewrite (parsetree=0x2a45798,
query_string=0x2a44a90 "select * from abcd;", paramTypes=0x0, numParams=0,
queryEnv=0x0)
    at postgres.c:694
#4  0x00000000008938a0 in exec_simple_query (query_string=0x2a44a90 "select
* from abcd;") at postgres.c:1120
#5  0x0000000000897c04 in PostgresMain (argc=1, argv=0x2a73268,
dbname=0x2a73178 "postgres", username=0x2a73158 "postgres") at
postgres.c:4271
#6  0x00000000008021a0 in BackendRun (port=0x2a6b260) at postmaster.c:4405
#7  0x0000000000801934 in BackendStartup (port=0x2a6b260) at
postmaster.c:4077
#8  0x00000000007fe148 in ServerLoop () at postmaster.c:1749
#9  0x00000000007fd936 in PostmasterMain (argc=3, argv=0x2a3cc40) at
postmaster.c:1399
#10 0x0000000000731bab in main (argc=3, argv=0x2a3cc40) at main.c:232
Breakpoint 2, pgss_post_parse_analyze (pstate=0x2a45808, query=0x2a45918) at
pg_stat_statements.c:782
statment 2: create table 
(gdb) bt
#0  pgss_post_parse_analyze (pstate=0x2a45808, query=0x2a45918) at
pg_stat_statements.c:782
#1  0x00007fbe60506734 in pg_hint_plan_post_parse_analyze (pstate=0x2a45808,
query=0x2a45918) at pg_hint_plan.c:2767
#2  0x000000000058fbe5 in parse_analyze (parseTree=0x2a45788,
sourceText=0x2a44a90 "create table abcd\n(i int);", paramTypes=0x0,
numParams=0, queryEnv=0x0)
    at analyze.c:124
#3  0x00000000008926b6 in pg_analyze_and_rewrite (parsetree=0x2a45788,
query_string=0x2a44a90 "create table abcd\n(i int);", paramTypes=0x0,
numParams=0, queryEnv=0x0)
    at postgres.c:694
#4  0x00000000008938a0 in exec_simple_query (query_string=0x2a44a90 "create
table abcd\n(i int);") at postgres.c:1120
#5  0x0000000000897c04 in PostgresMain (argc=1, argv=0x2a73268,
dbname=0x2a73178 "postgres", username=0x2a73158 "postgres") at
postgres.c:4271
#6  0x00000000008021a0 in BackendRun (port=0x2a6b260) at postmaster.c:4405
#7  0x0000000000801934 in BackendStartup (port=0x2a6b260) at
postmaster.c:4077
#8  0x00000000007fe148 in ServerLoop () at postmaster.c:1749
#9  0x00000000007fd936 in PostmasterMain (argc=3, argv=0x2a3cc40) at
postmaster.c:1399
#10 0x0000000000731bab in main (argc=3, argv=0x2a3cc40) at main.c:232
(gdb)

It will degrade performance and may cause the wrong result if it contains
modify operation.



view thread (3+ messages)  latest in thread

Message-ID: <16179-f7f1d45afb4452bb@postgresql.org>
Permalink:  ../16179-f7f1d45afb4452bb@postgresql.org/
Also on:    postgresql.org/message-id/16179-f7f1d45afb4452bb@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, zhq651@126.com
  Subject: Re: BUG #16179: is it reasonable to callback pgss_post_parse_analyze or pg_hint_plan_post_parse_analyze ???
  In-Reply-To: <16179-f7f1d45afb4452bb@postgresql.org>
  References: <16179-f7f1d45afb4452bb@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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