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

Commit 96f7745

Browse files
committed
Merge branch 'REL_10_STABLE' into PGPRO10
2 parents 39b3bd8 + f74d83b commit 96f7745

File tree

6 files changed

+302
-296
lines changed

6 files changed

+302
-296
lines changed

doc/src/sgml/plhandler.sgml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
<para>
1212
All calls to functions that are written in a language other than
1313
the current <quote>version 1</quote> interface for compiled
14-
languages (this includes functions in user-defined procedural languages,
15-
functions written in SQL, and functions using the version 0 compiled
16-
language interface) go through a <firstterm>call handler</firstterm>
14+
languages (this includes functions in user-defined procedural languages
15+
and functions written in SQL) go through a <firstterm>call handler</firstterm>
1716
function for the specific language. It is the responsibility of
1817
the call handler to execute the function in a meaningful way, such
1918
as by interpreting the supplied source text. This chapter outlines

doc/src/sgml/spi.sgml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4355,17 +4355,19 @@ INSERT INTO a SELECT * FROM a;
43554355
PG_MODULE_MAGIC;
43564356
#endif
43574357

4358-
int64 execq(text *sql, int cnt);
4358+
PG_FUNCTION_INFO_V1(execq);
43594359

4360-
int64
4361-
execq(text *sql, int cnt)
4360+
Datum
4361+
execq(PG_FUNCTION_ARGS)
43624362
{
43634363
char *command;
4364+
int cnt;
43644365
int ret;
43654366
uint64 proc;
43664367

43674368
/* Convert given text object to a C string */
4368-
command = text_to_cstring(sql);
4369+
command = text_to_cstring(PG_GETARG_TEXT_PP(1));
4370+
cnt = PG_GETARG_INT32(2);
43694371

43704372
SPI_connect();
43714373

@@ -4398,16 +4400,10 @@ execq(text *sql, int cnt)
43984400
SPI_finish();
43994401
pfree(command);
44004402

4401-
return (proc);
4403+
PG_RETURN_INT64(proc);
44024404
}
44034405
</programlisting>
44044406

4405-
<para>
4406-
(This function uses call convention version 0, to make the example
4407-
easier to understand. In real applications you should use the new
4408-
version 1 interface.)
4409-
</para>
4410-
44114407
<para>
44124408
This is how you declare the function after having compiled it into
44134409
a shared library (details are in <xref linkend="dfunc">.):

src/backend/statistics/dependencies.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,20 +631,27 @@ dependency_implies_attribute(MVDependency *dependency, AttrNumber attnum)
631631
MVDependencies *
632632
statext_dependencies_load(Oid mvoid)
633633
{
634+
MVDependencies *result;
634635
bool isnull;
635636
Datum deps;
636-
HeapTuple htup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(mvoid));
637+
HeapTuple htup;
637638

639+
htup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(mvoid));
638640
if (!HeapTupleIsValid(htup))
639641
elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
640642

641643
deps = SysCacheGetAttr(STATEXTOID, htup,
642644
Anum_pg_statistic_ext_stxdependencies, &isnull);
643-
Assert(!isnull);
645+
if (isnull)
646+
elog(ERROR,
647+
"requested statistic kind \"%c\" is not yet built for statistics object %u",
648+
STATS_EXT_DEPENDENCIES, mvoid);
649+
650+
result = statext_dependencies_deserialize(DatumGetByteaPP(deps));
644651

645652
ReleaseSysCache(htup);
646653

647-
return statext_dependencies_deserialize(DatumGetByteaP(deps));
654+
return result;
648655
}
649656

650657
/*

src/backend/statistics/mvdistinct.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,24 +126,27 @@ statext_ndistinct_build(double totalrows, int numrows, HeapTuple *rows,
126126
MVNDistinct *
127127
statext_ndistinct_load(Oid mvoid)
128128
{
129-
bool isnull = false;
129+
MVNDistinct *result;
130+
bool isnull;
130131
Datum ndist;
131132
HeapTuple htup;
132133

133134
htup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(mvoid));
134-
if (!htup)
135+
if (!HeapTupleIsValid(htup))
135136
elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
136137

137138
ndist = SysCacheGetAttr(STATEXTOID, htup,
138139
Anum_pg_statistic_ext_stxndistinct, &isnull);
139140
if (isnull)
140141
elog(ERROR,
141-
"requested statistic kind %c is not yet built for statistics object %u",
142+
"requested statistic kind \"%c\" is not yet built for statistics object %u",
142143
STATS_EXT_NDISTINCT, mvoid);
143144

145+
result = statext_ndistinct_deserialize(DatumGetByteaPP(ndist));
146+
144147
ReleaseSysCache(htup);
145148

146-
return statext_ndistinct_deserialize(DatumGetByteaP(ndist));
149+
return result;
147150
}
148151

149152
/*

src/test/regress/pg_regress.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,14 +1742,11 @@ run_schedule(const char *schedule, test_function tfunc)
17421742
*/
17431743
for (rl = resultfiles[i], el = expectfiles[i], tl = tags[i];
17441744
rl != NULL; /* rl and el have the same length */
1745-
rl = rl->next, el = el->next)
1745+
rl = rl->next, el = el->next,
1746+
tl = tl ? tl->next : NULL)
17461747
{
17471748
bool newdiff;
17481749

1749-
if (tl)
1750-
tl = tl->next; /* tl has the same length as rl and el if
1751-
* it exists */
1752-
17531750
newdiff = results_differ(tests[i], rl->str, el->str);
17541751
if (newdiff && tl)
17551752
{
@@ -1829,14 +1826,11 @@ run_single_test(const char *test, test_function tfunc)
18291826
*/
18301827
for (rl = resultfiles, el = expectfiles, tl = tags;
18311828
rl != NULL; /* rl and el have the same length */
1832-
rl = rl->next, el = el->next)
1829+
rl = rl->next, el = el->next,
1830+
tl = tl ? tl->next : NULL)
18331831
{
18341832
bool newdiff;
18351833

1836-
if (tl)
1837-
tl = tl->next; /* tl has the same length as rl and el if it
1838-
* exists */
1839-
18401834
newdiff = results_differ(test, rl->str, el->str);
18411835
if (newdiff && tl)
18421836
{

0 commit comments

Comments
 (0)