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

Commit9fac5fd

Browse files
committed
Move LockClauseStrength, LockWaitPolicy into new file nodes/lockoptions.h.
Commitdf630b0 moved enum LockWaitPolicyinto its very own header file utils/lockwaitpolicy.h, which does not seemlike a great idea from here. First, it's still a node-related declaration,and second, a file named like that can never sensibly be used for anythingelse. I do not think we want to encourage a one-typedef-per-header-fileapproach. The upcoming foreign table inheritance patch was doubling downon this bad idea by moving enum LockClauseStrength into its *own*can-never-be-used-for-anything-else file. Instead, let's put them both ina file named nodes/lockoptions.h. (They do seem to need a separate headerfile because we need them in both parsenodes.h and plannodes.h, and wedon't want either of those including the other. Past practice mightsuggest adding them to nodes/nodes.h, but they don't seem sufficientlyglobally useful to justify that.)Committed separately since there's no functional change here, just someheader-file refactoring.
1 parent8008959 commit9fac5fd

File tree

6 files changed

+48
-44
lines changed

6 files changed

+48
-44
lines changed

‎src/include/access/heapam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
#include"access/sdir.h"
1818
#include"access/skey.h"
19+
#include"nodes/lockoptions.h"
1920
#include"nodes/primnodes.h"
2021
#include"storage/bufpage.h"
2122
#include"storage/lock.h"
22-
#include"utils/lockwaitpolicy.h"
2323
#include"utils/relcache.h"
2424
#include"utils/snapshot.h"
2525

‎src/include/executor/executor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include"executor/execdesc.h"
1818
#include"nodes/parsenodes.h"
19-
#include"utils/lockwaitpolicy.h"
2019

2120

2221
/*

‎src/include/nodes/lockoptions.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* lockoptions.h
4+
* Common header for some locking-related declarations.
5+
*
6+
*
7+
* Copyright (c) 2014-2015, PostgreSQL Global Development Group
8+
*
9+
* src/include/nodes/lockoptions.h
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndefLOCKOPTIONS_H
14+
#defineLOCKOPTIONS_H
15+
16+
/*
17+
* This enum represents the different strengths of FOR UPDATE/SHARE clauses.
18+
* The ordering here is important, because the highest numerical value takes
19+
* precedence when a RTE is specified multiple ways. See applyLockingClause.
20+
*/
21+
typedefenumLockClauseStrength
22+
{
23+
LCS_FORKEYSHARE,/* FOR KEY SHARE */
24+
LCS_FORSHARE,/* FOR SHARE */
25+
LCS_FORNOKEYUPDATE,/* FOR NO KEY UPDATE */
26+
LCS_FORUPDATE/* FOR UPDATE */
27+
}LockClauseStrength;
28+
29+
/*
30+
* This enum controls how to deal with rows being locked by FOR UPDATE/SHARE
31+
* clauses (i.e., it represents the NOWAIT and SKIP LOCKED options).
32+
* The ordering here is important, because the highest numerical value takes
33+
* precedence when a RTE is specified multiple ways. See applyLockingClause.
34+
*/
35+
typedefenumLockWaitPolicy
36+
{
37+
/* Wait for the lock to become available (default behavior) */
38+
LockWaitBlock,
39+
/* Skip rows that can't be locked (SKIP LOCKED) */
40+
LockWaitSkip,
41+
/* Raise an error if a row cannot be locked (NOWAIT) */
42+
LockWaitError
43+
}LockWaitPolicy;
44+
45+
#endif/* LOCKOPTIONS_H */

‎src/include/nodes/parsenodes.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#definePARSENODES_H
2222

2323
#include"nodes/bitmapset.h"
24+
#include"nodes/lockoptions.h"
2425
#include"nodes/primnodes.h"
2526
#include"nodes/value.h"
26-
#include"utils/lockwaitpolicy.h"
2727

2828
/* Possible sources of a Query */
2929
typedefenumQuerySource
@@ -645,15 +645,6 @@ typedef struct DefElem
645645
* a location field --- currently, parse analysis insists on unqualified
646646
* names in LockingClause.)
647647
*/
648-
typedefenumLockClauseStrength
649-
{
650-
/* order is important -- see applyLockingClause */
651-
LCS_FORKEYSHARE,
652-
LCS_FORSHARE,
653-
LCS_FORNOKEYUPDATE,
654-
LCS_FORUPDATE
655-
}LockClauseStrength;
656-
657648
typedefstructLockingClause
658649
{
659650
NodeTagtype;

‎src/include/nodes/plannodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include"access/sdir.h"
1818
#include"lib/stringinfo.h"
1919
#include"nodes/bitmapset.h"
20+
#include"nodes/lockoptions.h"
2021
#include"nodes/primnodes.h"
21-
#include"utils/lockwaitpolicy.h"
2222

2323

2424
/* ----------------------------------------------------------------

‎src/include/utils/lockwaitpolicy.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp