OSDN Git Service

pghintplan/pg_hint_plan.git
2 years agoAdd forgotten test files master REL14_1_4_0
Kyotaro Horiguchi [Wed, 19 Jan 2022 06:12:22 +0000 (15:12 +0900)]
Add forgotten test files

9e2f8b6 forgot to contain the .sql and expected/.out files for
hints_anywhere feature. Add them.

2 years agoFix SEGV caused by duplicate memoize hints
Kyotaro Horiguchi [Wed, 19 Jan 2022 03:59:59 +0000 (12:59 +0900)]
Fix SEGV caused by duplicate memoize hints

HintTypeName was missing the item for the Memoize hint. This causes
SEGV or "(null)" printing by printf on erroring of duplicate memoize
hints.

Add the missing item and a static assertion to check the same kind of
fault.

Reported by ShangBenX <https://github.com/ShangBenX>

2 years agoProperly free all elements in a list
褚华兴 [Wed, 19 Jan 2022 02:37:57 +0000 (11:37 +0900)]
Properly free all elements in a list

HintStateDelete tried to free the elements of hstate->all_hints[] but
actually it only freed part of them.  Correct the code as it intended.

Some other palloced blocks are being hanged under the struct but we
don't bother trying to be perfect at cleaning up the whole struct
since it will be freed up at query end.

2 years agoFix many typos in doc
Kyotaro Horiguchi [Wed, 19 Jan 2022 01:37:00 +0000 (10:37 +0900)]
Fix many typos in doc

Many misspellings were left alone in the documentation.  Rechecked the
whole documentation and fixed the misspellings.

Reported-by: qianglingjie <86580516+qianglingjie@users.noreply.github.com>
2 years agoUse standard way of deleteing list cell
Maxim Orlov [Wed, 19 Jan 2022 01:16:27 +0000 (10:16 +0900)]
Use standard way of deleteing list cell

When the list implementation was changed, pg_hint_plan followed that
change by modifying existing use-side code.  Use instead
foreach_delete_current, which is the standard provided API to do the
same.

2 years agoAllow hints to be placed anywhere in query
Daniil Anisimov [Tue, 18 Jan 2022 08:40:35 +0000 (17:40 +0900)]
Allow hints to be placed anywhere in query

Hints description is restriected to be placed before certain
characters. That is effectively at the beginning of a query, or after
EXPLAIN or PREPARE.  This commit adds a new setting parameter
pg_hint_plan.hints_anywhere, which gets rid of that restriction.  When
it is on, pg_hint_plan ignores SQL syntax at all while reading hints
so there's no restricion on where hint string is placed in a query
string. On the other hand it may lead to false reads from a non-hint
strings.

2 years agoCreate README.md
Alex Rattray [Tue, 18 Jan 2022 07:24:50 +0000 (16:24 +0900)]
Create README.md

Add standard README.md file.  This file is a simple conversion from
existing document as a starter.

2 years agoAdd LD option --build-id only at RPM-build time
fengzh [Tue, 18 Jan 2022 07:18:19 +0000 (16:18 +0900)]
Add LD option --build-id only at RPM-build time

That option harms not only SunOS but also BSDs.  It is required by
rpmbuild so it is sensible to move the option from Makefile to SPEC
file.

2 years agoFix behavior for pg_hint_plan.debug_print
mikecaat [Tue, 18 Jan 2022 06:54:59 +0000 (15:54 +0900)]
Fix behavior for pg_hint_plan.debug_print

It was a kind of broken that some debug code paths are never visited
or that higher debug_level doesn't offer detailed messages.
Fix some debug messages' debug_level condition so that we can see the
proper messages for every debug_level.

2 years agoFix versions and copyright year of doc
Kyotaro Horiguchi [Tue, 18 Jan 2022 06:45:40 +0000 (15:45 +0900)]
Fix versions and copyright year of doc

2 years ago[DOC] Fix default value for pg_hint_plan.message_level
Kyotaro Horiguchi [Tue, 18 Jan 2022 06:43:26 +0000 (15:43 +0900)]
[DOC] Fix default value for pg_hint_plan.message_level

The actual default value for the variable is LOG so that the messages
are emitted to server log. Fix the documentation.

Per the report from jianggq@cn.fujitsu.com.

2 years agoLight-Weight spelling and grammar fixes
Robert Treat [Tue, 18 Jan 2022 06:13:20 +0000 (15:13 +0900)]
Light-Weight spelling and grammar fixes

Fix some fixes of spelling and grammar in the doc.

2 years agoFollowup change to support PG14
Kyotaro Horiguchi [Fri, 14 Jan 2022 08:51:08 +0000 (17:51 +0900)]
Followup change to support PG14

One improvement and on fix.

Ressurect post_parse_analysys_hook function to avoid redandunt
computation of jumble state if it is generated in-core.

Properly handle the case where compute_query_id is turned off while
pg_hint_plan.enable_hint_talbe is on.  This operation lead to a crash.

2 years agoUpdate copyright year of files
Tatsuro Yamada [Fri, 5 Nov 2021 04:17:10 +0000 (13:17 +0900)]
Update copyright year of files

2 years agoAllow run make check of PostgreSQL with loading pg_hint.plan
Kyotaro Horiguchi [Wed, 6 Oct 2021 02:51:44 +0000 (11:51 +0900)]
Allow run make check of PostgreSQL with loading pg_hint.plan

Automatically switch environment when pg_hint_plan is installed as a
part of "make check" of PostgreSQL.  That test is executed with the
following command line in the top directory of PostgreSQL tree.

make check EXTRA_INSTALL=<this directory> EXTRA_REGRESS_OPTS="--temp-config <this directory>/pg_hint_plan.conf"

make check-world fails for test that requires extra modules.

2 years agoSupport "Memoize" Hint.
Kyotaro Horiguchi [Tue, 5 Oct 2021 11:38:58 +0000 (20:38 +0900)]
Support "Memoize" Hint.

PostgreSQL 14 introduced the new optimization item "memoize", which
allows a join to memoize the inner result.  Add a hint to control this
feature.

2 years agoSupport PostgreSQL 14
Kyotaro Horiguchi [Tue, 5 Oct 2021 06:27:32 +0000 (15:27 +0900)]
Support PostgreSQL 14

In PostgreSQL 14, planner was restructured in regard to query string
passing.  This change allows us to remove fair amount of lines and
complexity that had been added as a struggle for retrieving proper
query string.

Two callbacks, post_parse_analyze_hook and ProcessUtility_hook are no
longer used.  get_query_string is removed altogether.  Also
current_hint_retrieved juggling, which was complex and fragile,
disappears. Now pg_hint_plan_planner alone can retrieve hint string by
looking into the given string.

In PostgreSQL 14, a new optimization item "memoize" is added. It is
not handled in this commit and leave it for a later commit.

3 years agoChange version to 1.3.7. REL13_1_3_7
Kyotaro Horiguchi [Wed, 28 Oct 2020 13:56:39 +0000 (22:56 +0900)]
Change version to 1.3.7.

3 years agoMake HashJoin hint more coercive.
Kyotaro Horiguchi [Wed, 28 Oct 2020 06:50:58 +0000 (15:50 +0900)]
Make HashJoin hint more coercive.

Even with HashJoin hint, hash joins may be rejected by planner if hash
table for the inner-rel is estimated too large.  Make HashJoin hint
more coercive by increasing hash_mem_multiplier.

3 years agoChange copyright year of docs to 2020
Kyotaro Horiguchi [Thu, 29 Oct 2020 12:02:28 +0000 (21:02 +0900)]
Change copyright year of docs to 2020

3 years agoStabilize regression test.
Kyotaro Horiguchi [Wed, 28 Oct 2020 13:58:48 +0000 (22:58 +0900)]
Stabilize regression test.

I was annoyed by frequent nonsubstantial change of title line length
of explain output.  This commit makes maskout.sh replace the title
lines with fixed content.

3 years agoFollow a behavioral change in core.
Kyotaro Horiguchi [Wed, 28 Oct 2020 09:03:05 +0000 (18:03 +0900)]
Follow a behavioral change in core.

Commit 894f5dea76 has changed the core's behavior of naming indexes.
Follow the changes. This is regression-result changes only.

3 years agoUpdate core.c and make_join_rel.c.
Kyotaro Horiguchi [Thu, 29 Oct 2020 04:54:40 +0000 (13:54 +0900)]
Update core.c and make_join_rel.c.

From this version core.c and make_join_rel.c are automatically
generated from core code.  Adjust them to auto-generated content.

3 years agoNew tool to generate source files for copied functions
Kyotaro Horiguchi [Thu, 29 Oct 2020 04:45:37 +0000 (13:45 +0900)]
New tool to generate source files for copied functions

Previously core.c and make_join_rel.c are maintained by hand. This
tool generates the files from corresponding core source files.

3 years agoAdd *.bc to .gitignore
Kyotaro Horiguchi [Thu, 29 Oct 2020 00:08:47 +0000 (09:08 +0900)]
Add *.bc to .gitignore

Added *.bc and *~ to .gitignore

3 years agoFollow the semantic change of pg_list part 2
Kyotaro Horiguchi [Wed, 28 Oct 2020 09:00:28 +0000 (18:00 +0900)]
Follow the semantic change of pg_list part 2

Commit 7ed93ce forgot to fix another place where list_delete_cell() is
used. Fix it.

3 years agoSupport PostgreSQL 13.
Kyotaro Horiguchi [Thu, 6 Aug 2020 11:18:05 +0000 (20:18 +0900)]
Support PostgreSQL 13.

- Follow change of some planner functions.

- Follow a change of the semantics of List.

- Take in changes in copied core code.

- Adjust regression tests.
  Amost all of the differences are come from aliasing policy, and some
  come from a new GUC parameter.

3 years agoVersion 1.3.6.
Kyotaro Horiguchi [Wed, 5 Aug 2020 07:30:25 +0000 (16:30 +0900)]
Version 1.3.6.

Fixed some bugs.

3 years agoAdd description of *ScanRegExp hints in the document.
sherlockcpp [Sun, 5 Apr 2020 13:18:31 +0000 (21:18 +0800)]
Add description of *ScanRegExp hints in the document.

English version of hint list is missing regexp versions of scan
hints. Add them.

3 years agoMask non-significant parts of regression output
Kyotaro Horiguchi [Tue, 14 Jul 2020 08:17:19 +0000 (17:17 +0900)]
Mask non-significant parts of regression output

To stabilize test, mask more of non-significant parts of EXPLAIN output.

3 years agoFix segfault when use Set, Rows and Parallel hints together
Daniil Anisimov [Mon, 16 Mar 2020 08:11:12 +0000 (15:11 +0700)]
Fix segfault when use Set, Rows and Parallel hints together

3 years agoFix some spelling errors in comments
Yang Rong [Thu, 21 May 2020 11:38:57 +0000 (19:38 +0800)]
Fix some spelling errors in comments

3 years agoMark hint table as a configuration table.
egashira.yusuke [Fri, 26 Jun 2020 11:09:51 +0000 (20:09 +0900)]
Mark hint table as a configuration table.

The table hint_plan.hints is a configuration table of
pg_hint_plan. Mark it as such, as well as its sequence table.

Back patch to pg_hint_plan96.

4 years agoPreparation for branch PG12 REL12_1_3_5
Kyotaro Horiguchi [Thu, 20 Feb 2020 12:24:14 +0000 (21:24 +0900)]
Preparation for branch PG12

Change version to 12-1.3.5. Adjust SPEC file.

4 years agoSupport PG12.
Kyotaro Horiguchi [Thu, 20 Feb 2020 11:53:24 +0000 (20:53 +0900)]
Support PG12.

As the prepparation for making PG12 branch, change PG version to 12
and adjust for the latest PG12.

4 years agoChange copyright year to 2020.
Kyotaro Horiguchi [Thu, 20 Feb 2020 11:19:44 +0000 (20:19 +0900)]
Change copyright year to 2020.

4 years agoRestore current hint state when returned from non-hinted query planning.
Kyotaro Horiguchi [Mon, 17 Feb 2020 10:46:28 +0000 (19:46 +0900)]
Restore current hint state when returned from non-hinted query planning.

If no hint is given for the current level query, pg_hint_plan_planner
calls the next level of planner after erasing the
current_hint_state. But it forgot to restore the state before the
planning of the rest part of the current-level query.  It is
(a-kind-of) broken by the commit d422966 but overlooked as an
inevitable side-effect of the fix.  Get back the behavior by restoring
current_hint_state after returned from the lower level planner with
unhinted query.

Issue: https://github.com/ossc-db/pg_hint_plan/issues/30
Reported-by: higuchi-daisuke
4 years agoUse proper type for non-integer GUC options.
Kyotaro Horiguchi [Mon, 17 Feb 2020 07:19:48 +0000 (16:19 +0900)]
Use proper type for non-integer GUC options.

pg_hint_plan internally preserved numeric options into integer
variable regardless of their types, which leads to unintentional
change of the values.  Handle double values in the proper way.

4 years agoFix Rows hint parsing
Kyotaro Horiguchi [Mon, 17 Feb 2020 05:53:27 +0000 (14:53 +0900)]
Fix Rows hint parsing

This is a long standing bug that Rows hint with no parameter causees a
crash. Fixed the Rows hint parser.

4 years agoGive correct query location to generate_normalized_query.
Kyotaro Horiguchi [Mon, 17 Feb 2020 04:15:39 +0000 (13:15 +0900)]
Give correct query location to generate_normalized_query.

There was a thinko about query_loc of generate_normalized_query which
causes a crash. For example a query is following a sequence of
semicolons (by \; in psql input) longer than the length after the last
placeholder to the end of the query, the function causes assertion
failure. Anyway prepared statements lose that value so we just pass 0
as the query_loc for consistent behavior.

4 years agoFix behavior of nested planning
Kyotaro Horiguchi [Fri, 14 Feb 2020 04:44:27 +0000 (13:44 +0900)]
Fix behavior of nested planning

Issue: https://github.com/ossc-db/pg_hint_plan/issues/39

When planning is nested by function call, the hints in the function
should affect the corresponding query. Maybe 9599067 introduced
that. Fix the nested planning behavior.

4 years agoFix crash bug caused by plancache invalidation
Kyotaro Horiguchi [Fri, 14 Feb 2020 03:34:55 +0000 (12:34 +0900)]
Fix crash bug caused by plancache invalidation

https://github.com/ossc-db/pg_hint_plan/issues/41

After plancache is invalidated then revaliated, get_query_string
accesses query_list of invalid plansource then crash. Ignore invalid
plancache and get the correct hint string and Query node at the next
planning time during revalidation.

On the way fixing this, a bug related to planner reentrance is
fixed. That fix causes behavioral change for nested
planning. Previously outer-level hint (wrongly) overrides inner-level
query but currenlty outer-level hint no longer affects inner-level
query.

4 years agoFix compiling error on Solaris
LittleWuCoding [Sat, 12 Jan 2019 10:11:04 +0000 (18:11 +0800)]
Fix  compiling error on Solaris

The 'LDFLAGS+=-Wl,--build-id' option is for rpm building in Linux like
OS.  The SunOS is not native support the option
'LDFLAGS+=-Wl,--build-id' . So, we disable this option in SunOS while
compiling.

Committed a bit tweaked version from the orignal.

4 years agoFix the previous commit.
Kyotaro Horiguchi [Thu, 13 Feb 2020 05:57:07 +0000 (14:57 +0900)]
Fix the previous commit.

The previous commit left a line to be removed. Remove it.

4 years agoDo null-check of error_context_stack before use
Kyotaro Horiguchi [Thu, 13 Feb 2020 05:34:01 +0000 (14:34 +0900)]
Do null-check of error_context_stack before use

The variable is accessed without null checking when planner is called
in the context of pl/pgsql. Fix it. Back-patched up to pg_hint_plan94.

Reporter: egashira-yusuke
Issue: https://github.com/ossc-db/pg_hint_plan/issues/42
Original-Author: sun-wei <30999182+Dagouhan@users.noreply.github.com>
Original-patch: https://github.com/ossc-db/pg_hint_plan/pull/45/commits/8fe092ef73a9af6cfb41e20717d7cb35aa74fce2

4 years agoFix regression tests.
Kyotaro Horiguchi [Tue, 29 Oct 2019 09:49:22 +0000 (18:49 +0900)]
Fix regression tests.

Fix regression tests to work for PG12.

4 years agoFollow the change in PG12.
Kyotaro Horiguchi [Tue, 29 Oct 2019 09:47:17 +0000 (18:47 +0900)]
Follow the change in PG12.

Commit 428b260f87 breaks the prior assumptions by adding one more
planning cycle for updates on partitioned tables. Follow the change.

4 years agoUpdate core.c based on PG12.0
Kyotaro Horiguchi [Tue, 29 Oct 2019 09:24:38 +0000 (18:24 +0900)]
Update core.c based on PG12.0

The following commits changes the original functions in core.c as of
REL_12_0. Took in the changes.

7ad6498fd5a654de6e743814c36cf619a3b5ddb6
45f8eaa8e3031c9cb12deb1b5e294bc052b378f2
f49842d1ee31b976c681322f76025d7732e860f3
7ad6498fd5a654de6e743814c36cf619a3b5ddb6

4 years agoFix definition of is_dummy_rel based on changes in community
Jignesh Shah [Sun, 2 Jun 2019 20:23:05 +0000 (20:23 +0000)]
Fix definition of is_dummy_rel based on changes in community

4 years agofix spelling mistakes in file pg_hint_plan.html
LittleWuCoding [Wed, 12 Dec 2018 06:47:13 +0000 (14:47 +0800)]
fix spelling mistakes in file pg_hint_plan.html

4 years agoUse ParallelHint in ParallelHintCreate()
Arthur Zakirov [Wed, 1 Aug 2018 16:27:23 +0000 (19:27 +0300)]
Use ParallelHint in ParallelHintCreate()

5 years agoSilence some compilers
Kyotaro Horiguchi [Fri, 8 Mar 2019 04:58:52 +0000 (13:58 +0900)]
Silence some compilers

Some compilers seem to complain about the previous patch, that
prev_hint_str is used uninitialized. Actually it is not but move the
initialization code out of the PG_TRY() section so that such compilers
would be quiet.

5 years agoCorrectly handle planner nesting
Kyotaro Horiguchi [Tue, 26 Feb 2019 07:10:29 +0000 (16:10 +0900)]
Correctly handle planner nesting

pg_hint_plan assumed that plpgsql is the only source of nested planner
calls. Actually nested call can be made in any shapes. Most of the
cases doesn't harm but in a special case where pg_dbms_stats makes a
SPI call during query planning, that affects subsequent planner
work. Hints lose effect when pg_dbms_stats searches "locked
statistics" tables while planning the target query.

9.5 is not affected. Back patched back to 9.6.

5 years agoFollow core's cobe/havor chages
Kyotaro Horiguchi [Tue, 26 Feb 2019 10:25:08 +0000 (19:25 +0900)]
Follow core's cobe/havor chages

Take in some changes took place in core code.

Commit 608b167f9f has largely changed the behavior around
CTE. Although I didn't confirmed that the all changes are valid as the
test for pg_hint_plan, just took in all plan differences.

5 years agoChange version to 1.3.4.
Kyotaro Horiguchi [Thu, 17 Jan 2019 09:53:12 +0000 (18:53 +0900)]
Change version to 1.3.4.

Fixed a minor bug of 1.3.3.

5 years agoFix condition to regenerate gather paths
Kyotaro Horiguchi [Thu, 17 Jan 2019 09:32:57 +0000 (18:32 +0900)]
Fix condition to regenerate gather paths

Core has additional condition to determine whether to generate gather
paths and pg_hint_plan forgot it. Fix it.

5 years agoChange version to 1.3.3
Kyotaro Horiguchi [Thu, 17 Jan 2019 03:33:00 +0000 (12:33 +0900)]
Change version to 1.3.3

Version bumped to 1.3.3. SPEC file is updated.

5 years agoFix reverse link of hint_list.html
Kyotaro Horiguchi [Thu, 17 Jan 2019 07:37:15 +0000 (16:37 +0900)]
Fix reverse link of hint_list.html

pg_hint_plan.html and hint_list.html pointed to the Japanese version
of main document. Fixed it.

5 years agoFix documentation.
Kyotaro Horiguchi [Thu, 17 Jan 2019 03:29:47 +0000 (12:29 +0900)]
Fix documentation.

Fixed wrong or stale descriptions, and poor or broken styles of
the documentation.

5 years agoInclude all pg_hint_plan--*.sql files in installation
Kyotaro Horiguchi [Thu, 17 Jan 2019 03:29:47 +0000 (12:29 +0900)]
Include all pg_hint_plan--*.sql files in installation

make install didn't install upgrade scripts. Fix it.

5 years agoChange copyright year to 2019
Kyotaro Horiguchi [Thu, 17 Jan 2019 03:11:17 +0000 (12:11 +0900)]
Change copyright year to 2019

5 years agoFix content of llvmjit package
Kyotaro Horiguchi [Thu, 17 Jan 2019 02:52:07 +0000 (11:52 +0900)]
Fix content of llvmjit package

The previous release is missing index.bc file and mislocating .bc file
in the llvmjit subpackage. The former is created at make install time
so use the standard make file to rpm-build.

5 years agoCatch up with the latest master
Kyotaro Horiguchi [Wed, 16 Jan 2019 08:28:47 +0000 (17:28 +0900)]
Catch up with the latest master

Some refactoring of header files and commits afb0d0712f and 1db5667bac
of core hit this. Catch up with them.

5 years agoCall standrad_ProcessUtility when no hook is set
Kyotaro Horiguchi [Wed, 9 Jan 2019 00:35:41 +0000 (09:35 +0900)]
Call standrad_ProcessUtility when no hook is set

The last commit d5ec243 forgot the case of no previous hook function
in the ProcessUtility hook function. Fix it.

5 years agoSupport prepared statements on extended protocol
Kyotaro Horiguchi [Mon, 7 Jan 2019 08:01:32 +0000 (17:01 +0900)]
Support prepared statements on extended protocol

However pg_hint_plan doesn't fully consider the extended protocol,
commit c05bb31 accidentially broke the case where an analyzed prepared
statement is executed on extended protocol. This patch fixes that only
for the hints-in-comment case. Hint-table still doesn't work in the
case since query-normalization needs Query, which is not available in
planner_hook.

5 years agoRemove an useless variable
Kyotaro Horiguchi [Mon, 7 Jan 2019 07:40:21 +0000 (16:40 +0900)]
Remove an useless variable

commit c05bb31 made the variable stmt_name useless. Remove it.

5 years agoAdjust regression test
Kyotaro Horiguchi [Mon, 7 Jan 2019 09:57:53 +0000 (18:57 +0900)]
Adjust regression test

Core behavior has changed, adjust regression test.

5 years agoAdjust regression test
Kyotaro Horiguchi [Wed, 5 Dec 2018 07:56:11 +0000 (16:56 +0900)]
Adjust regression test

Some regression test items need adjustment due to change of server
behavior. The way the regression test ignores unstable portions of
EXPLAIN output is changed along with that.

5 years agoFix for union-on-inheritance case
Kyotaro Horiguchi [Tue, 4 Dec 2018 04:19:57 +0000 (13:19 +0900)]
Fix for union-on-inheritance case

setup_hint_enforcement may pick up a wrong hint when multiple
subqueries access inheritance tables. This leads to failure to apply
hints on other than the first subquery.

5 years agoDon't reset plpgsql nest level at every command end
Kyotaro Horiguchi [Tue, 4 Dec 2018 01:33:55 +0000 (10:33 +0900)]
Don't reset plpgsql nest level at every command end

Clean up code for global exit is forgetting about loops that run
hinted commands multiple times. This leads to pg_hint_plan's failure
to affect after the first execution of the inner commands.
The hint below worked only for the first time.

FOR outer IN EXECUTE 'outer-command' LOOP
  FOR inner IN EXECUTE '/*+ hint */ inner-command' LOOP
    <something>
  END LOOP;
END LOOP;

5 years agoMinor document fix
Kyotaro Horiguchi [Tue, 13 Nov 2018 09:02:35 +0000 (18:02 +0900)]
Minor document fix

Just fix versions of PostgreSQL and OS.

5 years agoChange target version to PG11 and fix the SPEC file REL11_1_3_2
Kyotaro Horiguchi [Tue, 13 Nov 2018 01:29:17 +0000 (10:29 +0900)]
Change target version to PG11 and fix the SPEC file

Change targetr version to PG11. SPEC file was changed so that genearte
a subpackage llvmjit, which installs a bitcode file needed for JIT
compilation.

5 years agoFix copyright year
Kyotaro Horiguchi [Tue, 13 Nov 2018 04:05:06 +0000 (13:05 +0900)]
Fix copyright year

5 years agoFix regression test following core's behavior
Kyotaro Horiguchi [Tue, 13 Nov 2018 02:42:22 +0000 (11:42 +0900)]
Fix regression test following core's behavior

Some changes has been made on GUC default value and behavior. Follow
the change. No change was made on pg_hint_plan's behavior.

5 years agoUpdate core.c and make_jion_rel.c following core
Kyotaro Horiguchi [Tue, 13 Nov 2018 04:37:54 +0000 (13:37 +0900)]
Update core.c and make_jion_rel.c following core

Apply changes ever made on core.

5 years agoChange version to 1.3.2.
Kyotaro Horiguchi [Tue, 13 Nov 2018 06:59:57 +0000 (15:59 +0900)]
Change version to 1.3.2.

5 years agoFix debug output level control
Kyotaro Horiguchi [Tue, 13 Nov 2018 03:43:10 +0000 (12:43 +0900)]
Fix debug output level control

Previously parse_messages and message_level were binded to the same
internal variable. Separate the two GUCs. On the way doing this some
mssages that did not honor the variable were fixed. Default behavior
is not changed but the the two variables works differently from the
previous version, perhaps closer to expected.

5 years agoFix bogus error handling
Kyotaro Horiguchi [Tue, 13 Nov 2018 00:27:48 +0000 (09:27 +0900)]
Fix bogus error handling

For somewhat reason set_config_int32_options does bogus error
handling. Howerver that error cannot be happen, fixed it.

5 years agoChange version to 1.3.1.
Kyotaro Horiguchi [Tue, 13 Nov 2018 06:54:20 +0000 (15:54 +0900)]
Change version to 1.3.1.

1.3.0 has a crash bug in Describe message of extended protocol
path. If server receives the message after invalidation of
corresponding query cache, pg_hint_plan crashes.

5 years agoTook in several improvements of pg_stat_statements
Kyotaro Horiguchi [Fri, 8 Jun 2018 03:27:03 +0000 (12:27 +0900)]
Took in several improvements of pg_stat_statements

Following two commits are took in.

83f2061dd0 Teach contrib/pg_stat_statements to handle multi-statement commands better.
0bb51aa967 Improve parsetree representation of special functions such as CURRENT_DATE.

The following one makes change of documented behavior of pg_hint_plan
so it is not took in.

a6f22e8356 Show ignored constants as "$N" rather than "?" in pg_stat_statements.

5 years agoSupport PG11
Kyotaro Horiguchi [Thu, 14 Jun 2018 10:15:14 +0000 (19:15 +0900)]
Support PG11

Support PG11. Just adapted to PG11 in this version. No behavior
changes except Parallel hint. PG11 gets many new parallel features and
as a matter of course they made deadly impact on Parallel hint. It no
longer works in the same way with the earlier version except for quite
simple cases.

5 years agoFix a crash bug in case debug_query_string is NULL
Kyotaro Horiguchi [Thu, 24 May 2018 09:18:29 +0000 (18:18 +0900)]
Fix a crash bug in case debug_query_string is NULL

pg_hint_plan believed that debug_query_string cannot be null when
parse_analyze is called, but for example in the case under
exec_describe_statement_message, it is not. We see the query string in
pstate even in the case, so use it instead in the case. Since pstate
is storing the query of the lowermost level, we should use
debug_query_string in other cases.

6 years agoMove expected/ut-W.out to output/ut-W.source
Kyotaro Horiguchi [Mon, 6 Nov 2017 06:28:36 +0000 (15:28 +0900)]
Move expected/ut-W.out to output/ut-W.source

ut-W.out contained an absolute path of my working directory. Moved the
file into output so that we can remove the path replacing with
@abs_srcdir@.

6 years agoUse @abs_srcdir@ within ut-fdw.source
Arthur Zakirov [Thu, 2 Nov 2017 13:10:10 +0000 (16:10 +0300)]
Use @abs_srcdir@ within ut-fdw.source

The file contained absolute path of a specific working directory,
replace them with @abs_srcdir@.

6 years agoAdded and removed some entries in .gitignore
Kyotaro Horiguchi [Mon, 6 Nov 2017 05:38:49 +0000 (14:38 +0900)]
Added and removed some entries in .gitignore

Removed core.c, that is not appropriate.
Added .deps and RPMS.

6 years agoRemove mark_dummy_rel() from core.c
Kyotaro Horiguchi [Mon, 6 Nov 2017 06:52:53 +0000 (15:52 +0900)]
Remove mark_dummy_rel() from core.c

The function is exposed by the commit
f49842d1ee31b976c681322f76025d7732e860f3 so remove it from the file.

6 years agoUse pg_strcasecmp instead of strcasecmp for the sake of portability
Arthur Zakirov [Thu, 2 Nov 2017 13:00:09 +0000 (16:00 +0300)]
Use pg_strcasecmp instead of strcasecmp for the sake of portability

Back patched to branches PG93-96 and PG10.

6 years agoChange version to 1.3.0
Kyotaro Horiguchi [Tue, 10 Oct 2017 02:49:25 +0000 (11:49 +0900)]
Change version to 1.3.0

6 years agoAdded a notice in the manual.
Kyotaro Horiguchi [Tue, 10 Oct 2017 03:17:58 +0000 (12:17 +0900)]
Added a notice in the manual.

Added an item that explains about letter case handling of object names
in hints.

6 years agoPrepare for rpm build for PostgreSQL 10
Kyotaro Horiguchi [Tue, 10 Oct 2017 02:37:39 +0000 (11:37 +0900)]
Prepare for rpm build for PostgreSQL 10

Edited Makefile and SPEC file so that RPM package for PostgreSQL 10 is
built.

6 years agoAdded a regtest for partitioned table.
Kyotaro Horiguchi [Tue, 10 Oct 2017 02:20:13 +0000 (11:20 +0900)]
Added a regtest for partitioned table.

Added a minimal regression test that checks this works also on
partitioned tables. Currently partitioned tables are handled in almost
the same way with inheritance tables so this would be enough.

6 years agoCorrected copyright year and a indentation.
Kyotaro Horiguchi [Tue, 10 Oct 2017 01:34:19 +0000 (10:34 +0900)]
Corrected copyright year and a indentation.

Edited a copyright notice in which year is left alone. Correct an
indentation in make_join_rel.c. No functional change.

6 years agoReflected changes as of release 10.0.
Kyotaro Horiguchi [Tue, 10 Oct 2017 01:33:00 +0000 (10:33 +0900)]
Reflected changes as of release 10.0.

add_paths_to_append_rel gets modified as of relase 10.0. Reflected it
to core.c

6 years agoAdd a regression about forcing gather-merge.
Kyotaro Horiguchi [Wed, 4 Oct 2017 00:46:43 +0000 (09:46 +0900)]
Add a regression about forcing gather-merge.

The previous commit is said to allow enforce gather merge but no
regression for that is not included. This adds that.

6 years agoModify expected files.
Kyotaro Horiguchi [Thu, 27 Jul 2017 10:09:22 +0000 (19:09 +0900)]
Modify expected files.

At 10 beta2, planner seems to get some changes to affect plans used in
regression test. Tentatively modify it just to pass the regression.
Probably it is no problem but should be checked later.

6 years agoUp to date with 10 beta 2
Kyotaro Horiguchi [Thu, 27 Jul 2017 10:07:55 +0000 (19:07 +0900)]
Up to date with 10 beta 2

Make copied code to be up to date with the core as of 10 beta 2.

6 years agoSupport DECLARE CURSOR syntax and added regression for table hinting.
Kyotaro Horiguchi [Thu, 27 Jul 2017 03:26:55 +0000 (12:26 +0900)]
Support DECLARE CURSOR syntax and added regression for table hinting.

Previous version forgets to treat DECLARE CURSOR. Added that.
Addition to that, regression test for table hinting is added.

6 years agoSupport PostgreSQL 10 beta 1 step 2/2
Kyotaro Horiguchi [Tue, 6 Jun 2017 10:56:41 +0000 (19:56 +0900)]
Support PostgreSQL 10 beta 1 step 2/2

Changed the logic to tweak parallel execution paths so that it handles
more wider (parallel index scans or gather merge, specifically) range
of parallel paths.

6 years agoSupport PostgreSQL 10 beta 1 step 1/2
Kyotaro Horiguchi [Tue, 6 Jun 2017 10:23:17 +0000 (19:23 +0900)]
Support PostgreSQL 10 beta 1 step 1/2

The first half of the work to support PostgreSQL 10.

This just makes it can work with the version of PG. So partial index
paths are lost during Parallel hint processing.  Regression tests are
heavily modified but most of them just comes from the change of
original planner behavior introduced at the point of Pg10.

6 years agoFix a bug of target query retrieval
Kyotaro Horiguchi [Fri, 19 May 2017 01:11:55 +0000 (10:11 +0900)]
Fix a bug of target query retrieval

The previous patch leaves a bug that get_query_string returns a Query
that JumbleQuery doesn't accept. This fixes that bug.