Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e4dccd

Browse files
committed
Merge branch 'REL9_5_STABLE' ofhttps://github.com/postgres/postgres into PGPRO9_5
2 parents8fb55e5 +da9659f commit7e4dccd

File tree

31 files changed

+702
-238
lines changed

31 files changed

+702
-238
lines changed

‎contrib/intarray/bench/bench.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292

9393
if ($opt{e})
9494
{
95-
$dbi->do("explain$sql");
95+
my@plan =map {"$_->[0]\n" } @{$dbi->selectall_arrayref("explain$sql")};
96+
print@plan;
9697
}
9798

9899
my$t0 = [gettimeofday];

‎contrib/pgcrypto/px.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static const struct error_desc px_err_list[] = {
4848
{PXE_BAD_OPTION,"Unknown option"},
4949
{PXE_BAD_FORMAT,"Badly formatted type"},
5050
{PXE_KEY_TOO_BIG,"Key was too big"},
51-
{PXE_CIPHER_INIT,"Cipher cannot beinitalized ?"},
51+
{PXE_CIPHER_INIT,"Cipher cannot beinitialized ?"},
5252
{PXE_HASH_UNUSABLE_FOR_HMAC,"This hash algorithm is unusable for HMAC"},
5353
{PXE_DEV_READ_ERROR,"Error reading from random device"},
5454
{PXE_OSSL_RAND_ERROR,"OpenSSL PRNG error"},

‎doc/src/sgml/adminpack.sgml

Lines changed: 140 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,151 @@
1212
<application>pgAdmin</> and other administration and management tools can
1313
use to provide additional functionality, such as remote management
1414
of server log files.
15+
Use of all these functions is restricted to superusers.
1516
</para>
1617

17-
<sect2>
18-
<title>Functions Implemented</title>
18+
<para>
19+
The functions shown in <xref linkend="functions-adminpack-table"> provide
20+
write access to files on the machine hosting the server. (See also the
21+
functions in <xref linkend="functions-admin-genfile-table">, which
22+
provide read-only access.)
23+
Only files within the database cluster directory can be accessed, but
24+
either a relative or absolute path is allowable.
25+
</para>
26+
27+
<table id="functions-adminpack-table">
28+
<title><filename>adminpack</> Functions</title>
29+
<tgroup cols="3">
30+
<thead>
31+
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
32+
</row>
33+
</thead>
1934

20-
<para>
21-
The functions implemented by <filename>adminpack</> can only be run by a
22-
superuser. Here's a list of these functions:
35+
<tbody>
36+
<row>
37+
<entry><function>pg_catalog.pg_file_write(filename text, data text, append boolean)</function></entry>
38+
<entry><type>bigint</type></entry>
39+
<entry>
40+
Write, or append to, a text file
41+
</entry>
42+
</row>
43+
<row>
44+
<entry><function>pg_catalog.pg_file_rename(oldname text, newname text <optional>, archivename text</optional>)</function></entry>
45+
<entry><type>boolean</type></entry>
46+
<entry>
47+
Rename a file
48+
</entry>
49+
</row>
50+
<row>
51+
<entry><function>pg_catalog.pg_file_unlink(filename text)</function></entry>
52+
<entry><type>boolean</type></entry>
53+
<entry>
54+
Remove a file
55+
</entry>
56+
</row>
57+
<row>
58+
<entry><function>pg_catalog.pg_logdir_ls()</function></entry>
59+
<entry><type>setof record</type></entry>
60+
<entry>
61+
List the log files in the <varname>log_directory</> directory
62+
</entry>
63+
</row>
64+
</tbody>
65+
</tgroup>
66+
</table>
67+
68+
<indexterm>
69+
<primary>pg_file_write</primary>
70+
</indexterm>
71+
<para>
72+
<function>pg_file_write</> writes the specified <parameter>data</> into
73+
the file named by <parameter>filename</>. If <parameter>append</> is
74+
false, the file must not already exist. If <parameter>append</> is true,
75+
the file can already exist, and will be appended to if so.
76+
Returns the number of bytes written.
77+
</para>
78+
79+
<indexterm>
80+
<primary>pg_file_rename</primary>
81+
</indexterm>
82+
<para>
83+
<function>pg_file_rename</> renames a file. If <parameter>archivename</>
84+
is omitted or NULL, it simply renames <parameter>oldname</>
85+
to <parameter>newname</> (which must not already exist).
86+
If <parameter>archivename</> is provided, it first
87+
renames <parameter>newname</> to <parameter>archivename</> (which must
88+
not already exist), and then renames <parameter>oldname</>
89+
to <parameter>newname</>. In event of failure of the second rename step,
90+
it will try to rename <parameter>archivename</> back
91+
to <parameter>newname</> before reporting the error.
92+
Returns true on success, false if the source file(s) are not present or
93+
not writable; other cases throw errors.
94+
</para>
2395

24-
<programlisting>
25-
int8 pg_catalog.pg_file_write(fname text, data text, append bool)
26-
bool pg_catalog.pg_file_rename(oldname text, newname text, archivename text)
27-
bool pg_catalog.pg_file_rename(oldname text, newname text)
28-
bool pg_catalog.pg_file_unlink(fname text)
29-
setof record pg_catalog.pg_logdir_ls()
96+
<indexterm>
97+
<primary>pg_file_unlink</primary>
98+
</indexterm>
99+
<para>
100+
<function>pg_file_unlink</> removes the specified file.
101+
Returns true on success, false if the specified file is not present
102+
or the <function>unlink()</> call fails; other cases throw errors.
103+
</para>
104+
105+
<indexterm>
106+
<primary>pg_logdir_ls</primary>
107+
</indexterm>
108+
<para>
109+
<function>pg_logdir_ls</> returns the start timestamps and path
110+
names of all the log files in the <xref linkend="guc-log-directory">
111+
directory. The <xref linkend="guc-log-filename"> parameter must have its
112+
default setting (<literal>postgresql-%Y-%m-%d_%H%M%S.log</>) to use this
113+
function.
114+
</para>
115+
116+
<para>
117+
The functions shown
118+
in <xref linkend="functions-adminpack-deprecated-table"> are deprecated
119+
and should not be used in new applications; instead use those shown
120+
in <xref linkend="functions-admin-signal-table">
121+
and <xref linkend="functions-admin-genfile-table">. These functions are
122+
provided in <filename>adminpack</> only for compatibility with old
123+
versions of <application>pgAdmin</>.
124+
</para>
30125

31-
/* Renaming of existing backend functions for pgAdmin compatibility */
32-
int8 pg_catalog.pg_file_read(fname text, data text, append bool)
33-
bigint pg_catalog.pg_file_length(text)
34-
int4 pg_catalog.pg_logfile_rotate()
35-
</programlisting>
36-
</para>
126+
<table id="functions-adminpack-deprecated-table">
127+
<title>Deprecated <filename>adminpack</> Functions</title>
128+
<tgroup cols="3">
129+
<thead>
130+
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry>
131+
</row>
132+
</thead>
37133

38-
</sect2>
134+
<tbody>
135+
<row>
136+
<entry><function>pg_catalog.pg_file_read(filename text, offset bigint, nbytes bigint)</function></entry>
137+
<entry><type>text</type></entry>
138+
<entry>
139+
Alternate name for <function>pg_read_file()</>
140+
</entry>
141+
</row>
142+
<row>
143+
<entry><function>pg_catalog.pg_file_length(filename text)</function></entry>
144+
<entry><type>bigint</type></entry>
145+
<entry>
146+
Same as <structfield>size</> column returned
147+
by <function>pg_stat_file()</>
148+
</entry>
149+
</row>
150+
<row>
151+
<entry><function>pg_catalog.pg_logfile_rotate()</function></entry>
152+
<entry><type>integer</type></entry>
153+
<entry>
154+
Alternate name for <function>pg_rotate_logfile()</>, but note that it
155+
returns integer 0 or 1 rather than boolean
156+
</entry>
157+
</row>
158+
</tbody>
159+
</tgroup>
160+
</table>
39161

40162
</sect1>

‎doc/src/sgml/logicaldecoding.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
192192
</para>
193193
</sect2>
194194

195-
<sect2>
195+
<sect2 id="logicaldecoding-replication-slots">
196196
<title>Replication Slots</title>
197197

198198
<indexterm>

‎doc/src/sgml/ref/alter_function.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="paramet
236236
setting is removed, so that the function executes with the value
237237
present in its environment. Use <literal>RESET
238238
ALL</literal> to clear all function-local settings.
239-
<literal>SET FROM CURRENT</> saves the session's current value of
240-
the parameter as the value to be applied when the function is entered.
239+
<literal>SET FROM CURRENT</> saves the value of the parameter that
240+
is current when <command>ALTER FUNCTION</> is executed as the value
241+
to be applied when the function is entered.
241242
</para>
242243

243244
<para>

‎doc/src/sgml/ref/create_function.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,9 @@ CREATE [ OR REPLACE ] FUNCTION
448448
The <literal>SET</> clause causes the specified configuration
449449
parameter to be set to the specified value when the function is
450450
entered, and then restored to its prior value when the function exits.
451-
<literal>SET FROM CURRENT</> saves the session's current value of
452-
the parameter as the value to be applied when the function is entered.
451+
<literal>SET FROM CURRENT</> saves the value of the parameter that
452+
is current when <command>CREATE FUNCTION</> is executed as the value
453+
to be applied when the function is entered.
453454
</para>
454455

455456
<para>

‎doc/src/sgml/ref/select.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
391391
not been changed meanwhile. But different seed values will usually
392392
produce different samples.
393393
If <literal>REPEATABLE</literal> is not given then a new random
394-
sample is selected for each query.
394+
seed is selected for each query.
395395
Note that some add-on sampling methods do not
396396
accept <literal>REPEATABLE</literal>, and will always produce new
397397
samples on each use.

‎src/backend/access/heap/heapam.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ heap_delete(Relation relation, ItemPointer tid,
31123112
Assert(!HeapTupleHasExternal(&tp));
31133113
}
31143114
elseif (HeapTupleHasExternal(&tp))
3115-
toast_delete(relation,&tp);
3115+
toast_delete(relation,&tp, false);
31163116

31173117
/*
31183118
* Mark tuple for invalidation from system caches at next command
@@ -5723,7 +5723,8 @@ heap_finish_speculative(Relation relation, HeapTuple tuple)
57235723
* could deadlock with each other, which would not be acceptable.
57245724
*
57255725
* This is somewhat redundant with heap_delete, but we prefer to have a
5726-
* dedicated routine with stripped down requirements.
5726+
* dedicated routine with stripped down requirements. Note that this is also
5727+
* used to delete the TOAST tuples created during speculative insertion.
57275728
*
57285729
* This routine does not affect logical decoding as it only looks at
57295730
* confirmation records.
@@ -5767,7 +5768,7 @@ heap_abort_speculative(Relation relation, HeapTuple tuple)
57675768
*/
57685769
if (tp.t_data->t_choice.t_heap.t_xmin!=xid)
57695770
elog(ERROR,"attempted to kill a tuple inserted by another transaction");
5770-
if (!HeapTupleHeaderIsSpeculative(tp.t_data))
5771+
if (!(IsToastRelation(relation)||HeapTupleHeaderIsSpeculative(tp.t_data)))
57715772
elog(ERROR,"attempted to kill a non-speculative tuple");
57725773
Assert(!HeapTupleHeaderIsHeapOnly(tp.t_data));
57735774

@@ -5837,7 +5838,10 @@ heap_abort_speculative(Relation relation, HeapTuple tuple)
58375838
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
58385839

58395840
if (HeapTupleHasExternal(&tp))
5840-
toast_delete(relation,&tp);
5841+
{
5842+
Assert(!IsToastRelation(relation));
5843+
toast_delete(relation,&tp, true);
5844+
}
58415845

58425846
/*
58435847
* Never need to mark tuple for invalidation, since catalogs don't support

‎src/backend/access/heap/tuptoaster.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ typedef struct toast_compress_header
6666
#defineTOAST_COMPRESS_SET_RAWSIZE(ptr,len) \
6767
(((toast_compress_header *) (ptr))->rawsize = (len))
6868

69-
staticvoidtoast_delete_datum(Relationrel,Datumvalue);
69+
staticvoidtoast_delete_datum(Relationrel,Datumvalue,boolis_speculative);
7070
staticDatumtoast_save_datum(Relationrel,Datumvalue,
7171
structvarlena*oldexternal,intoptions);
7272
staticbooltoastrel_valueid_exists(Relationtoastrel,Oidvalueid);
@@ -459,7 +459,7 @@ toast_datum_size(Datum value)
459459
* ----------
460460
*/
461461
void
462-
toast_delete(Relationrel,HeapTupleoldtup)
462+
toast_delete(Relationrel,HeapTupleoldtup,boolis_speculative)
463463
{
464464
TupleDesctupleDesc;
465465
Form_pg_attribute*att;
@@ -506,7 +506,7 @@ toast_delete(Relation rel, HeapTuple oldtup)
506506
if (toast_isnull[i])
507507
continue;
508508
elseif (VARATT_IS_EXTERNAL_ONDISK(PointerGetDatum(value)))
509-
toast_delete_datum(rel,value);
509+
toast_delete_datum(rel,value,is_speculative);
510510
}
511511
}
512512
}
@@ -1062,7 +1062,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
10621062
if (need_delold)
10631063
for (i=0;i<numAttrs;i++)
10641064
if (toast_delold[i])
1065-
toast_delete_datum(rel,toast_oldvalues[i]);
1065+
toast_delete_datum(rel,toast_oldvalues[i], false);
10661066

10671067
returnresult_tuple;
10681068
}
@@ -1654,7 +1654,7 @@ toast_save_datum(Relation rel, Datum value,
16541654
* ----------
16551655
*/
16561656
staticvoid
1657-
toast_delete_datum(Relationrel,Datumvalue)
1657+
toast_delete_datum(Relationrel,Datumvalue,boolis_speculative)
16581658
{
16591659
structvarlena*attr= (structvarlena*)DatumGetPointer(value);
16601660
structvaratt_externaltoast_pointer;
@@ -1703,7 +1703,10 @@ toast_delete_datum(Relation rel, Datum value)
17031703
/*
17041704
* Have a chunk, delete it
17051705
*/
1706-
simple_heap_delete(toastrel,&toasttup->t_self);
1706+
if (is_speculative)
1707+
heap_abort_speculative(toastrel,toasttup);
1708+
else
1709+
simple_heap_delete(toastrel,&toasttup->t_self);
17071710
}
17081711

17091712
/*

‎src/backend/commands/explain.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include"optimizer/clauses.h"
2626
#include"parser/parsetree.h"
2727
#include"rewrite/rewriteHandler.h"
28+
#include"storage/bufmgr.h"
2829
#include"tcop/tcopprot.h"
2930
#include"utils/builtins.h"
3031
#include"utils/json.h"
@@ -684,16 +685,20 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, ExplainState *es)
684685
appendStringInfo(es->str," for constraint %s",conname);
685686
if (show_relname)
686687
appendStringInfo(es->str," on %s",relname);
687-
appendStringInfo(es->str,": time=%.3f calls=%.0f\n",
688-
1000.0*instr->total,instr->ntuples);
688+
if (es->timing)
689+
appendStringInfo(es->str,": time=%.3f calls=%.0f\n",
690+
1000.0*instr->total,instr->ntuples);
691+
else
692+
appendStringInfo(es->str,": calls=%.0f\n",instr->ntuples);
689693
}
690694
else
691695
{
692696
ExplainPropertyText("Trigger Name",trig->tgname,es);
693697
if (conname)
694698
ExplainPropertyText("Constraint Name",conname,es);
695699
ExplainPropertyText("Relation",relname,es);
696-
ExplainPropertyFloat("Time",1000.0*instr->total,3,es);
700+
if (es->timing)
701+
ExplainPropertyFloat("Time",1000.0*instr->total,3,es);
697702
ExplainPropertyFloat("Calls",instr->ntuples,0,es);
698703
}
699704

@@ -1600,8 +1605,11 @@ ExplainNode(PlanState *planstate, List *ancestors,
16001605
ExplainPropertyLong("Local Written Blocks",usage->local_blks_written,es);
16011606
ExplainPropertyLong("Temp Read Blocks",usage->temp_blks_read,es);
16021607
ExplainPropertyLong("Temp Written Blocks",usage->temp_blks_written,es);
1603-
ExplainPropertyFloat("I/O Read Time",INSTR_TIME_GET_MILLISEC(usage->blk_read_time),3,es);
1604-
ExplainPropertyFloat("I/O Write Time",INSTR_TIME_GET_MILLISEC(usage->blk_write_time),3,es);
1608+
if (track_io_timing)
1609+
{
1610+
ExplainPropertyFloat("I/O Read Time",INSTR_TIME_GET_MILLISEC(usage->blk_read_time),3,es);
1611+
ExplainPropertyFloat("I/O Write Time",INSTR_TIME_GET_MILLISEC(usage->blk_write_time),3,es);
1612+
}
16051613
}
16061614
}
16071615

‎src/backend/executor/spi.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,8 +2224,12 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
22242224
strtoul(completionTag+7,NULL,10);
22252225
else
22262226
{
2227-
/* Must be an IF NOT EXISTS that did nothing */
2228-
Assert(ctastmt->if_not_exists);
2227+
/*
2228+
* Must be an IF NOT EXISTS that did nothing, or a
2229+
* CREATE ... WITH NO DATA.
2230+
*/
2231+
Assert(ctastmt->if_not_exists||
2232+
ctastmt->into->skipData);
22292233
_SPI_current->processed=0;
22302234
}
22312235

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp