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

Commit37af9c4

Browse files
committed
Merge branch 'PGPRO9_6' into PGPROEE9_6
Conflicts:src/backend/access/heap/ptrack.c
2 parents261da38 +bdbee68 commit37af9c4

File tree

150 files changed

+6695
-1848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+6695
-1848
lines changed

‎contrib/pg_buffercache/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ MODULE_big = pg_buffercache
44
OBJS = pg_buffercache_pages.o$(WIN32RES)
55

66
EXTENSION = pg_buffercache
7-
DATA = pg_buffercache--1.2.sql pg_buffercache--1.1--1.2.sql\
8-
pg_buffercache--1.0--1.1.sql pg_buffercache--unpackaged--1.0.sql
7+
DATA = pg_buffercache--1.3.sql pg_buffercache--1.2--1.3.sql\
8+
pg_buffercache--1.1--1.2.sql pg_buffercache--1.0--1.1.sql\
9+
pg_buffercache--unpackaged--1.0.sql
910
PGFILEDESC = "pg_buffercache - monitoring of shared buffer cache in real-time"
1011

1112
ifdefUSE_PGXS
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* contrib/pg_buffercache/pg_buffercache--1.2--1.3.sql*/
2+
3+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
4+
\echo Use"ALTER EXTENSION pg_buffercache(text) UPDATE TO '1.3'" to load this file. \quit
5+
6+
ALTERFUNCTION pg_buffercache_pages() PARALLEL SAFE;

‎contrib/pg_buffercache/pg_buffercache--1.2.sqlrenamed to‎contrib/pg_buffercache/pg_buffercache--1.3.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* contrib/pg_buffercache/pg_buffercache--1.2.sql*/
1+
/* contrib/pg_buffercache/pg_buffercache--1.3.sql*/
22

33
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
44
\echo Use"CREATE EXTENSION pg_buffercache" to load this file. \quit
@@ -18,4 +18,4 @@ CREATE VIEW pg_buffercache AS
1818

1919
-- Don't want these to be available to public.
2020
REVOKE ALLON FUNCTION pg_buffercache_pages()FROM PUBLIC;
21-
REVOKE ALLON pg_buffercacheFROM PUBLIC;
21+
REVOKE ALLON pg_buffercacheFROM PUBLIC;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pg_buffercache extension
22
comment = 'examine the shared buffer cache'
3-
default_version = '1.2'
3+
default_version = '1.3'
44
module_pathname = '$libdir/pg_buffercache'
55
relocatable = true

‎contrib/pg_buffercache/pg_buffercache_pages.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,6 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
135135
/* Return to original context when allocating transient memory */
136136
MemoryContextSwitchTo(oldcontext);
137137

138-
/*
139-
* To get a consistent picture of the buffer state, we must lock all
140-
* partitions of the buffer map. Needless to say, this is horrible
141-
* for concurrency. Must grab locks in increasing order to avoid
142-
* possible deadlocks.
143-
*/
144-
for (i=0;i<NUM_BUFFER_PARTITIONS;i++)
145-
LWLockAcquire(BufMappingPartitionLockByIndex(i),LW_SHARED);
146-
147138
/*
148139
* Scan through all the buffers, saving the relevant fields in the
149140
* fctx->record structure.
@@ -154,6 +145,12 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
154145
uint32buf_state;
155146

156147
bufHdr=GetBufferDescriptor(i);
148+
if (bufHdr->tag.forkNum==-1)
149+
{
150+
fctx->record[i].blocknum=InvalidBlockNumber;
151+
continue;
152+
}
153+
157154
/* Lock each buffer header before inspecting. */
158155
buf_state=LockBufHdr(bufHdr);
159156

@@ -179,16 +176,6 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
179176

180177
UnlockBufHdr(bufHdr,buf_state);
181178
}
182-
183-
/*
184-
* And release locks. We do this in reverse order for two reasons:
185-
* (1) Anyone else who needs more than one of the locks will be trying
186-
* to lock them in increasing order; we don't want to release the
187-
* other process until it can get all the locks it needs. (2) This
188-
* avoids O(N^2) behavior inside LWLockRelease.
189-
*/
190-
for (i=NUM_BUFFER_PARTITIONS;--i >=0;)
191-
LWLockRelease(BufMappingPartitionLockByIndex(i));
192179
}
193180

194181
funcctx=SRF_PERCALL_SETUP();

‎contrib/pg_pathman/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ REGRESS = pathman_basic \
1919
pathman_domains\
2020
pathman_foreign_keys\
2121
pathman_permissions\
22-
pathman_rowmarks
22+
pathman_rowmarks\
23+
pathman_copy_stmt_hooking\
24+
pathman_calamity
2325
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
2426
EXTRA_CLEAN = pg_pathman--$(EXTVERSION).sql ./isolation_output
2527

Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
\set VERBOSITY terse
2+
CREATE EXTENSION pg_pathman;
3+
CREATE SCHEMA calamity;
4+
/* call for coverage test */
5+
set client_min_messages = ERROR;
6+
SELECT debug_capture();
7+
debug_capture
8+
---------------
9+
10+
(1 row)
11+
12+
set client_min_messages = NOTICE;
13+
/* create table to be partitioned */
14+
CREATE TABLE calamity.part_test(val serial);
15+
/* check function validate_relname() */
16+
SELECT validate_relname('calamity.part_test');
17+
validate_relname
18+
--------------------
19+
calamity.part_test
20+
(1 row)
21+
22+
/* SELECT validate_relname(NULL); -- FIXME: %s */
23+
/* check function get_parent_of_partition() */
24+
SELECT get_parent_of_partition('calamity.part_test');
25+
ERROR: "part_test" is not a partition
26+
SELECT get_parent_of_partition(NULL) IS NULL;
27+
?column?
28+
----------
29+
t
30+
(1 row)
31+
32+
/* check function get_base_type() */
33+
CREATE DOMAIN calamity.test_domain AS INT4;
34+
SELECT get_base_type('int4'::regtype);
35+
get_base_type
36+
---------------
37+
integer
38+
(1 row)
39+
40+
SELECT get_base_type('calamity.test_domain'::regtype);
41+
get_base_type
42+
---------------
43+
integer
44+
(1 row)
45+
46+
SELECT get_base_type(NULL) IS NULL;
47+
?column?
48+
----------
49+
t
50+
(1 row)
51+
52+
/* check function get_attribute_type() */
53+
SELECT get_attribute_type('calamity.part_test', 'val');
54+
get_attribute_type
55+
--------------------
56+
integer
57+
(1 row)
58+
59+
SELECT get_attribute_type('calamity.part_test', NULL) IS NULL;
60+
?column?
61+
----------
62+
t
63+
(1 row)
64+
65+
SELECT get_attribute_type(NULL, 'val') IS NULL;
66+
?column?
67+
----------
68+
t
69+
(1 row)
70+
71+
SELECT get_attribute_type(NULL, NULL) IS NULL;
72+
?column?
73+
----------
74+
t
75+
(1 row)
76+
77+
/* check function build_check_constraint_name_attnum() */
78+
SELECT build_check_constraint_name('calamity.part_test', 1::int2);
79+
build_check_constraint_name
80+
-----------------------------
81+
pathman_part_test_1_check
82+
(1 row)
83+
84+
SELECT build_check_constraint_name('calamity.part_test', NULL::int2) IS NULL;
85+
?column?
86+
----------
87+
t
88+
(1 row)
89+
90+
SELECT build_check_constraint_name(NULL, 1::int2) IS NULL;
91+
?column?
92+
----------
93+
t
94+
(1 row)
95+
96+
SELECT build_check_constraint_name(NULL, NULL::int2) IS NULL;
97+
?column?
98+
----------
99+
t
100+
(1 row)
101+
102+
/* check function build_check_constraint_name_attname() */
103+
SELECT build_check_constraint_name('calamity.part_test', 'val');
104+
build_check_constraint_name
105+
-----------------------------
106+
pathman_part_test_1_check
107+
(1 row)
108+
109+
SELECT build_check_constraint_name('calamity.part_test', NULL::text) IS NULL;
110+
?column?
111+
----------
112+
t
113+
(1 row)
114+
115+
SELECT build_check_constraint_name(NULL, 'val') IS NULL;
116+
?column?
117+
----------
118+
t
119+
(1 row)
120+
121+
SELECT build_check_constraint_name(NULL, NULL::text) IS NULL;
122+
?column?
123+
----------
124+
t
125+
(1 row)
126+
127+
/* check function build_update_trigger_name() */
128+
SELECT build_update_trigger_name('calamity.part_test');
129+
build_update_trigger_name
130+
---------------------------
131+
part_test_upd_trig
132+
(1 row)
133+
134+
SELECT build_update_trigger_name(NULL) IS NULL;
135+
?column?
136+
----------
137+
t
138+
(1 row)
139+
140+
/* check function build_update_trigger_func_name() */
141+
SELECT build_update_trigger_func_name('calamity.part_test');
142+
build_update_trigger_func_name
143+
----------------------------------
144+
calamity.part_test_upd_trig_func
145+
(1 row)
146+
147+
SELECT build_update_trigger_func_name(NULL) IS NULL;
148+
?column?
149+
----------
150+
t
151+
(1 row)
152+
153+
/* check invoke_on_partition_created_callback() for RANGE */
154+
SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', 1, NULL, NULL::int);
155+
ERROR: both bounds must be provided for RANGE partition
156+
SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', 1, 1, NULL);
157+
ERROR: both bounds must be provided for RANGE partition
158+
SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', 1, NULL, 1);
159+
ERROR: both bounds must be provided for RANGE partition
160+
/* check invoke_on_partition_created_callback() for HASH */
161+
SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', NULL);
162+
invoke_on_partition_created_callback
163+
--------------------------------------
164+
165+
(1 row)
166+
167+
SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', 0);
168+
invoke_on_partition_created_callback
169+
--------------------------------------
170+
171+
(1 row)
172+
173+
SELECT invoke_on_partition_created_callback(NULL, 'calamity.part_test', 1);
174+
ERROR: parent_relid should not be null
175+
SELECT invoke_on_partition_created_callback('calamity.part_test', NULL, 1);
176+
ERROR: partition should not be null
177+
/* check function add_to_pathman_config() -- PHASE #1 */
178+
SELECT add_to_pathman_config('calamity.part_test', NULL);
179+
ERROR: attname should not be null
180+
SELECT add_to_pathman_config('calamity.part_test', 'val');
181+
add_to_pathman_config
182+
-----------------------
183+
t
184+
(1 row)
185+
186+
SELECT disable_pathman_for('calamity.part_test');
187+
NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
188+
disable_pathman_for
189+
---------------------
190+
191+
(1 row)
192+
193+
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
194+
add_to_pathman_config
195+
-----------------------
196+
t
197+
(1 row)
198+
199+
SELECT disable_pathman_for('calamity.part_test');
200+
NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
201+
disable_pathman_for
202+
---------------------
203+
204+
(1 row)
205+
206+
/* check function add_to_pathman_config() -- PHASE #2 */
207+
CREATE TABLE calamity.part_ok(val serial);
208+
INSERT INTO calamity.part_ok SELECT generate_series(1, 2);
209+
SELECT create_hash_partitions('calamity.part_ok', 'val', 4);
210+
create_hash_partitions
211+
------------------------
212+
4
213+
(1 row)
214+
215+
CREATE TABLE calamity.wrong_partition (LIKE calamity.part_test) INHERITS (calamity.part_test); /* wrong partition w\o constraints */
216+
NOTICE: merging column "val" with inherited definition
217+
SELECT add_to_pathman_config('calamity.part_test', 'val');
218+
ERROR: constraint "pathman_wrong_partition_1_check" for partition "wrong_partition" does not exist
219+
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
220+
QUERY PLAN
221+
-----------------------------
222+
Append
223+
-> Seq Scan on part_ok_0
224+
-> Seq Scan on part_ok_1
225+
-> Seq Scan on part_ok_2
226+
-> Seq Scan on part_ok_3
227+
(5 rows)
228+
229+
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
230+
ERROR: constraint "pathman_wrong_partition_1_check" for partition "wrong_partition" does not exist
231+
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
232+
QUERY PLAN
233+
-----------------------------
234+
Append
235+
-> Seq Scan on part_ok_0
236+
-> Seq Scan on part_ok_1
237+
-> Seq Scan on part_ok_2
238+
-> Seq Scan on part_ok_3
239+
(5 rows)
240+
241+
ALTER TABLE calamity.wrong_partition
242+
ADD CONSTRAINT pathman_wrong_partition_1_check
243+
CHECK (val < 10); /* wrong constraint */
244+
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
245+
ERROR: Wrong constraint format for RANGE partition "wrong_partition"
246+
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
247+
QUERY PLAN
248+
-----------------------------
249+
Append
250+
-> Seq Scan on part_ok_0
251+
-> Seq Scan on part_ok_1
252+
-> Seq Scan on part_ok_2
253+
-> Seq Scan on part_ok_3
254+
(5 rows)
255+
256+
ALTER TABLE calamity.wrong_partition DROP CONSTRAINT pathman_wrong_partition_1_check;
257+
ALTER TABLE calamity.wrong_partition
258+
ADD CONSTRAINT pathman_wrong_partition_1_check
259+
CHECK (val = 1 OR val = 2); /* wrong constraint */
260+
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
261+
ERROR: Wrong constraint format for RANGE partition "wrong_partition"
262+
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
263+
QUERY PLAN
264+
-----------------------------
265+
Append
266+
-> Seq Scan on part_ok_0
267+
-> Seq Scan on part_ok_1
268+
-> Seq Scan on part_ok_2
269+
-> Seq Scan on part_ok_3
270+
(5 rows)
271+
272+
ALTER TABLE calamity.wrong_partition DROP CONSTRAINT pathman_wrong_partition_1_check;
273+
ALTER TABLE calamity.wrong_partition
274+
ADD CONSTRAINT pathman_wrong_partition_1_check
275+
CHECK (val >= 10 AND val = 2); /* wrong constraint */
276+
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
277+
ERROR: Wrong constraint format for RANGE partition "wrong_partition"
278+
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
279+
QUERY PLAN
280+
-----------------------------
281+
Append
282+
-> Seq Scan on part_ok_0
283+
-> Seq Scan on part_ok_1
284+
-> Seq Scan on part_ok_2
285+
-> Seq Scan on part_ok_3
286+
(5 rows)
287+
288+
ALTER TABLE calamity.wrong_partition DROP CONSTRAINT pathman_wrong_partition_1_check;
289+
/* check GUC variable */
290+
SHOW pg_pathman.enable;
291+
pg_pathman.enable
292+
-------------------
293+
on
294+
(1 row)
295+
296+
DROP SCHEMA calamity CASCADE;
297+
NOTICE: drop cascades to 8 other objects
298+
DROP EXTENSION pg_pathman;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp