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

Commitfe591f8

Browse files
committed
Replace enum InhOption with simple boolean.
Now that it has only INH_NO and INH_YES values, it's just weird thatit's not a plain bool, so make it that way.Also rename RangeVar.inhOpt to "inh", to be like RangeTblEntry.inh.My recollection is that we gave it a different name specifically becauseit had a different representation than the derived bool value, but itno longer does. And this is a good forcing function to be sure wecatch any places that are affected by the change.Bump catversion because of possible effect on stored RangeVar nodes.I'm not exactly convinced that we ever store RangeVar on disk, butwe have a readfuncs function for it, so be cautious. (If we do do so,then commite13486e was in error not to bump catversion.)Follow-on to commite13486e.Discussion:http://postgr.es/m/CA+TgmoYe+EG7LdYX6pkcNxr4ygkP4+A=jm9o-CPXyOvRiCNwaQ@mail.gmail.com
1 parent158df30 commitfe591f8

File tree

12 files changed

+22
-31
lines changed

12 files changed

+22
-31
lines changed

‎src/backend/commands/lockcmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ LockTableCommand(LockStmt *lockstmt)
5454
foreach(p,lockstmt->relations)
5555
{
5656
RangeVar*rv= (RangeVar*)lfirst(p);
57-
boolrecurse=(rv->inhOpt==INH_YES);
57+
boolrecurse=rv->inh;
5858
Oidreloid;
5959

6060
reloid=RangeVarGetRelidExtended(rv,lockstmt->mode, false,

‎src/backend/commands/tablecmds.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ ExecuteTruncate(TruncateStmt *stmt)
11841184
{
11851185
RangeVar*rv=lfirst(cell);
11861186
Relationrel;
1187-
boolrecurse=(rv->inhOpt==INH_YES);
1187+
boolrecurse=rv->inh;
11881188
Oidmyrelid;
11891189

11901190
rel=heap_openrv(rv,AccessExclusiveLock);
@@ -2655,7 +2655,7 @@ renameatt(RenameStmt *stmt)
26552655
renameatt_internal(relid,
26562656
stmt->subname,/* old att name */
26572657
stmt->newname,/* new att name */
2658-
(stmt->relation->inhOpt==INH_YES),/* recursive? */
2658+
stmt->relation->inh,/* recursive? */
26592659
false,/* recursing? */
26602660
0,/* expected inhcount */
26612661
stmt->behavior);
@@ -2807,7 +2807,8 @@ RenameConstraint(RenameStmt *stmt)
28072807
rename_constraint_internal(relid,typid,
28082808
stmt->subname,
28092809
stmt->newname,
2810-
(stmt->relation&&stmt->relation->inhOpt==INH_YES),/* recursive? */
2810+
(stmt->relation&&
2811+
stmt->relation->inh),/* recursive? */
28112812
false,/* recursing? */
28122813
0/* expected inhcount */ );
28132814

@@ -3049,9 +3050,7 @@ AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt)
30493050

30503051
CheckTableNotInUse(rel,"ALTER TABLE");
30513052

3052-
ATController(stmt,
3053-
rel,stmt->cmds, (stmt->relation->inhOpt==INH_YES),
3054-
lockmode);
3053+
ATController(stmt,rel,stmt->cmds,stmt->relation->inh,lockmode);
30553054
}
30563055

30573056
/*

‎src/backend/nodes/copyfuncs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ _copyRangeVar(const RangeVar *from)
11121112
COPY_STRING_FIELD(catalogname);
11131113
COPY_STRING_FIELD(schemaname);
11141114
COPY_STRING_FIELD(relname);
1115-
COPY_SCALAR_FIELD(inhOpt);
1115+
COPY_SCALAR_FIELD(inh);
11161116
COPY_SCALAR_FIELD(relpersistence);
11171117
COPY_NODE_FIELD(alias);
11181118
COPY_LOCATION_FIELD(location);
@@ -4192,7 +4192,6 @@ _copyAlterPolicyStmt(const AlterPolicyStmt *from)
41924192
staticPartitionSpec*
41934193
_copyPartitionSpec(constPartitionSpec*from)
41944194
{
4195-
41964195
PartitionSpec*newnode=makeNode(PartitionSpec);
41974196

41984197
COPY_STRING_FIELD(strategy);

‎src/backend/nodes/equalfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ _equalRangeVar(const RangeVar *a, const RangeVar *b)
108108
COMPARE_STRING_FIELD(catalogname);
109109
COMPARE_STRING_FIELD(schemaname);
110110
COMPARE_STRING_FIELD(relname);
111-
COMPARE_SCALAR_FIELD(inhOpt);
111+
COMPARE_SCALAR_FIELD(inh);
112112
COMPARE_SCALAR_FIELD(relpersistence);
113113
COMPARE_NODE_FIELD(alias);
114114
COMPARE_LOCATION_FIELD(location);

‎src/backend/nodes/makefuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ makeRangeVar(char *schemaname, char *relname, int location)
423423
r->catalogname=NULL;
424424
r->schemaname=schemaname;
425425
r->relname=relname;
426-
r->inhOpt=INH_YES;
426+
r->inh=true;
427427
r->relpersistence=RELPERSISTENCE_PERMANENT;
428428
r->alias=NULL;
429429
r->location=location;

‎src/backend/nodes/outfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ _outRangeVar(StringInfo str, const RangeVar *node)
939939
*/
940940
WRITE_STRING_FIELD(schemaname);
941941
WRITE_STRING_FIELD(relname);
942-
WRITE_ENUM_FIELD(inhOpt,InhOption);
942+
WRITE_BOOL_FIELD(inh);
943943
WRITE_CHAR_FIELD(relpersistence);
944944
WRITE_NODE_FIELD(alias);
945945
WRITE_LOCATION_FIELD(location);

‎src/backend/nodes/readfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ _readRangeVar(void)
449449

450450
READ_STRING_FIELD(schemaname);
451451
READ_STRING_FIELD(relname);
452-
READ_ENUM_FIELD(inhOpt,InhOption);
452+
READ_BOOL_FIELD(inh);
453453
READ_CHAR_FIELD(relpersistence);
454454
READ_NODE_FIELD(alias);
455455
READ_LOCATION_FIELD(location);

‎src/backend/parser/analyze.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
380380

381381
/* set up range table with just the result rel */
382382
qry->resultRelation=setTargetTable(pstate,stmt->relation,
383-
(stmt->relation->inhOpt==INH_YES),
383+
stmt->relation->inh,
384384
true,
385385
ACL_DELETE);
386386

@@ -2177,7 +2177,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
21772177
}
21782178

21792179
qry->resultRelation=setTargetTable(pstate,stmt->relation,
2180-
(stmt->relation->inhOpt==INH_YES),
2180+
stmt->relation->inh,
21812181
true,
21822182
ACL_UPDATE);
21832183

‎src/backend/parser/gram.y

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11250,28 +11250,28 @@ relation_expr:
1125011250
{
1125111251
/* inheritance query, implicitly*/
1125211252
$$ =$1;
11253-
$$->inhOpt =INH_YES;
11253+
$$->inh =true;
1125411254
$$->alias =NULL;
1125511255
}
1125611256
|qualified_name'*'
1125711257
{
11258-
/* inheritance query*/
11258+
/* inheritance query, explicitly*/
1125911259
$$ =$1;
11260-
$$->inhOpt =INH_YES;
11260+
$$->inh =true;
1126111261
$$->alias =NULL;
1126211262
}
1126311263
|ONLYqualified_name
1126411264
{
1126511265
/* no inheritance*/
1126611266
$$ =$2;
11267-
$$->inhOpt =INH_NO;
11267+
$$->inh =false;
1126811268
$$->alias =NULL;
1126911269
}
1127011270
|ONLY'('qualified_name')'
1127111271
{
1127211272
/* no inheritance, SQL99-style syntax*/
1127311273
$$ =$3;
11274-
$$->inhOpt =INH_NO;
11274+
$$->inh =false;
1127511275
$$->alias =NULL;
1127611276
}
1127711277
;

‎src/backend/parser/parse_clause.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ transformTableEntry(ParseState *pstate, RangeVar *r)
412412
RangeTblEntry*rte;
413413

414414
/* We need only build a range table entry */
415-
rte=addRangeTableEntry(pstate,r,r->alias,
416-
(r->inhOpt==INH_YES), true);
415+
rte=addRangeTableEntry(pstate,r,r->alias,r->inh, true);
417416

418417
returnrte;
419418
}

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201612202
56+
#defineCATALOG_VERSION_NO201612231
5757

5858
#endif

‎src/include/nodes/primnodes.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ typedef struct Alias
4242
List*colnames;/* optional list of column aliases */
4343
}Alias;
4444

45-
typedefenumInhOption
46-
{
47-
INH_NO,/* Do NOT scan child tables */
48-
INH_YES/* DO scan child tables */
49-
}InhOption;
50-
5145
/* What to do at commit time for temporary relations */
5246
typedefenumOnCommitAction
5347
{
@@ -61,7 +55,7 @@ typedef enum OnCommitAction
6155
* RangeVar - range variable, used in FROM clauses
6256
*
6357
* Also used to represent table names in utility statements; there, the alias
64-
* field is not used, andinhOpt shows whether to apply the operation
58+
* field is not used, andinh tells whether to apply the operation
6559
* recursively to child tables. In some contexts it is also useful to carry
6660
* a TEMP table indication here.
6761
*/
@@ -71,7 +65,7 @@ typedef struct RangeVar
7165
char*catalogname;/* the catalog (database) name, or NULL */
7266
char*schemaname;/* the schema name, or NULL */
7367
char*relname;/* the relation/sequence name */
74-
InhOptioninhOpt;/* expand rel by inheritance? recursively act
68+
boolinh;/* expand rel by inheritance? recursively act
7569
* on children? */
7670
charrelpersistence;/* see RELPERSISTENCE_* in pg_class.h */
7771
Alias*alias;/* table alias & optional column aliases */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp