Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0d53c8b

Browse files
committed
Merge branch 'PGPROEE10' into PGPROEE10_test_xid-64
2 parents 7903b6d + 98d60a8 commit 0d53c8b

File tree

7 files changed

+40
-32
lines changed

7 files changed

+40
-32
lines changed

contrib/rum/expected/array_1.out

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,14 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info
525525
(4 rows)
526526

527527
SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
528-
ERROR: doesn't support order by over pass-by-reference column
528+
i | add_info
529+
-----------+--------------------------
530+
{1} | Thu May 19 14:21:25 2016
531+
{1,2} | Fri May 20 14:21:25 2016
532+
{1,2,3} | Sat May 21 14:21:25 2016
533+
{1,2,3,4} | Sun May 22 14:21:25 2016
534+
(4 rows)
535+
529536
DROP INDEX idx_array;
530537
/*
531538
* Sanity checks for popular array types.

contrib/rum/src/rum.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,4 +1057,20 @@ extern Datum FunctionCall10Coll(FmgrInfo *flinfo, Oid collation,
10571057
Datum arg6, Datum arg7, Datum arg8,
10581058
Datum arg9, Datum arg10);
10591059

1060+
/* PostgreSQL version-agnostic creation of memory context */
1061+
#if PG_VERSION_NUM >= 110000
1062+
#define RumContextCreate(parent, name) \
1063+
AllocSetContextCreateExtended(parent, name, \
1064+
MEMCONTEXT_COPY_NAME, \
1065+
ALLOCSET_DEFAULT_MINSIZE, \
1066+
ALLOCSET_DEFAULT_INITSIZE, \
1067+
ALLOCSET_DEFAULT_MAXSIZE)
1068+
#else
1069+
#define RumContextCreate(parent, name) \
1070+
AllocSetContextCreate(parent, name, \
1071+
ALLOCSET_DEFAULT_MINSIZE, \
1072+
ALLOCSET_DEFAULT_INITSIZE, \
1073+
ALLOCSET_DEFAULT_MAXSIZE)
1074+
#endif
1075+
10601076
#endif /* __RUM_H__ */

contrib/rum/src/ruminsert.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -633,17 +633,11 @@ rumbuild(Relation heap, Relation index, struct IndexInfo *indexInfo)
633633
* create a temporary memory context that is reset once for each tuple
634634
* inserted into the index
635635
*/
636-
buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext,
637-
"Rum build temporary context",
638-
ALLOCSET_DEFAULT_MINSIZE,
639-
ALLOCSET_DEFAULT_INITSIZE,
640-
ALLOCSET_DEFAULT_MAXSIZE);
641-
642-
buildstate.funcCtx = AllocSetContextCreate(CurrentMemoryContext,
643-
"Rum build temporary context for user-defined function",
644-
ALLOCSET_DEFAULT_MINSIZE,
645-
ALLOCSET_DEFAULT_INITSIZE,
646-
ALLOCSET_DEFAULT_MAXSIZE);
636+
buildstate.tmpCtx = RumContextCreate(CurrentMemoryContext,
637+
"Rum build temporary context");
638+
639+
buildstate.funcCtx = RumContextCreate(CurrentMemoryContext,
640+
"Rum build temporary context for user-defined function");
647641

648642
buildstate.accum.rumstate = &buildstate.rumstate;
649643
rumInitBA(&buildstate.accum);
@@ -813,11 +807,8 @@ ruminsert(Relation index, Datum *values, bool *isnull,
813807
Datum outerAddInfo = (Datum) 0;
814808
bool outerAddInfoIsNull = true;
815809

816-
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
817-
"Rum insert temporary context",
818-
ALLOCSET_DEFAULT_MINSIZE,
819-
ALLOCSET_DEFAULT_INITSIZE,
820-
ALLOCSET_DEFAULT_MAXSIZE);
810+
insertCtx = RumContextCreate(CurrentMemoryContext,
811+
"Rum insert temporary context");
821812

822813
oldCtx = MemoryContextSwitchTo(insertCtx);
823814

contrib/rum/src/rumscan.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,10 @@ rumbeginscan(Relation rel, int nkeys, int norderbys)
3535
so->firstCall = true;
3636
so->totalentries = 0;
3737
so->sortedEntries = NULL;
38-
so->tempCtx = AllocSetContextCreate(CurrentMemoryContext,
39-
"Rum scan temporary context",
40-
ALLOCSET_DEFAULT_MINSIZE,
41-
ALLOCSET_DEFAULT_INITSIZE,
42-
ALLOCSET_DEFAULT_MAXSIZE);
43-
so->keyCtx = AllocSetContextCreate(CurrentMemoryContext,
44-
"Rum scan key context",
45-
ALLOCSET_DEFAULT_MINSIZE,
46-
ALLOCSET_DEFAULT_INITSIZE,
47-
ALLOCSET_DEFAULT_MAXSIZE);
38+
so->tempCtx = RumContextCreate(CurrentMemoryContext,
39+
"Rum scan temporary context");
40+
so->keyCtx = RumContextCreate(CurrentMemoryContext,
41+
"Rum scan key context");
4842

4943
initRumState(&so->rumstate, scan->indexRelation);
5044

contrib/rum/src/rumsort.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -877,11 +877,7 @@ rum_tuplesort_begin_common(int workMem, bool randomAccess)
877877
* Create a working memory context for this sort operation. All data
878878
* needed by the sort will live inside this context.
879879
*/
880-
sortcontext = AllocSetContextCreate(CurrentMemoryContext,
881-
"TupleSort",
882-
ALLOCSET_DEFAULT_MINSIZE,
883-
ALLOCSET_DEFAULT_INITSIZE,
884-
ALLOCSET_DEFAULT_MAXSIZE);
880+
sortcontext = RumContextCreate(CurrentMemoryContext, "TupleSort");
885881

886882
/*
887883
* Make the Tuplesortstate within the per-sort context. This way, we

src/bin/psql/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
2121
override CPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
2222
override LDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) $(LDFLAGS)
2323

24+
# We need product name in the enviroment of create_help.pl
25+
export PRODUCT_NAME
2426
OBJS= command.o common.o conditional.o copy.o crosstabview.o \
2527
describe.o help.o input.o large_obj.o mainloop.o \
2628
prompt.o psqlscanslash.o sql_help.o startup.o stringutils.o \

src/bin/psql/create_help.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
open(my $fh, '<', "$docdir/$file") or next;
101101
my $filecontent = join('', <$fh>);
102102
close $fh;
103+
# Substitute &productname; entity
104+
$filecontent =~ s/\&productname;/$ENV{PRODUCT_NAME}/gs;
103105

104106
# Ignore files that are not for SQL language statements
105107
$filecontent =~

0 commit comments

Comments
 (0)