mirror of
https://github.com/postgres/postgres.git
synced 2026-03-23 02:43:22 -04:00
Use LOCKMODE in parse_relation.c/.h
There were a couple of comments in parse_relation.c > Note: properly, lockmode should be declared LOCKMODE not int, but that > would require importing storage/lock.h into parse_relation.h. Since > LOCKMODE is typedef'd as int anyway, that seems like overkill. but actually LOCKMODE has been in storage/lockdefs.h for a while, which is intentionally a more narrow header. So we can include that one in parse_relation.h and just use LOCKMODE normally. An alternative would be to add a duplicate typedef into parse_relation.h, but that doesn't seem necessary here. Reviewed-by: Andreas Karlsson <andreas@proxel.se> Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/4bcd65fb-2497-484c-bb41-83cb435eb64d%40eisentraut.org
This commit is contained in:
parent
4966bd3ed9
commit
aca61f7e5f
2 changed files with 5 additions and 12 deletions
|
|
@ -1422,13 +1422,9 @@ buildNSItemFromLists(RangeTblEntry *rte, Index rtindex,
|
|||
* This is essentially just the same as table_openrv(), except that it caters
|
||||
* to some parser-specific error reporting needs, notably that it arranges
|
||||
* to include the RangeVar's parse location in any resulting error.
|
||||
*
|
||||
* Note: properly, lockmode should be declared LOCKMODE not int, but that
|
||||
* would require importing storage/lock.h into parse_relation.h. Since
|
||||
* LOCKMODE is typedef'd as int anyway, that seems like overkill.
|
||||
*/
|
||||
Relation
|
||||
parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
|
||||
parserOpenTable(ParseState *pstate, const RangeVar *relation, LOCKMODE lockmode)
|
||||
{
|
||||
Relation rel;
|
||||
ParseCallbackState pcbstate;
|
||||
|
|
@ -1571,15 +1567,11 @@ addRangeTableEntry(ParseState *pstate,
|
|||
* of AccessShareLock, RowShareLock, or RowExclusiveLock depending on the
|
||||
* RTE's role within the query. The caller must hold that lock mode
|
||||
* or a stronger one.
|
||||
*
|
||||
* Note: properly, lockmode should be declared LOCKMODE not int, but that
|
||||
* would require importing storage/lock.h into parse_relation.h. Since
|
||||
* LOCKMODE is typedef'd as int anyway, that seems like overkill.
|
||||
*/
|
||||
ParseNamespaceItem *
|
||||
addRangeTableEntryForRelation(ParseState *pstate,
|
||||
Relation rel,
|
||||
int lockmode,
|
||||
LOCKMODE lockmode,
|
||||
Alias *alias,
|
||||
bool inh,
|
||||
bool inFromCl)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#define PARSE_RELATION_H
|
||||
|
||||
#include "parser/parse_node.h"
|
||||
#include "storage/lockdefs.h"
|
||||
|
||||
|
||||
extern ParseNamespaceItem *refnameNamespaceItem(ParseState *pstate,
|
||||
|
|
@ -44,7 +45,7 @@ extern Node *colNameToVar(ParseState *pstate, const char *colname, bool localonl
|
|||
extern void markNullableIfNeeded(ParseState *pstate, Var *var);
|
||||
extern void markVarForSelectPriv(ParseState *pstate, Var *var);
|
||||
extern Relation parserOpenTable(ParseState *pstate, const RangeVar *relation,
|
||||
int lockmode);
|
||||
LOCKMODE lockmode);
|
||||
extern ParseNamespaceItem *addRangeTableEntry(ParseState *pstate,
|
||||
RangeVar *relation,
|
||||
Alias *alias,
|
||||
|
|
@ -52,7 +53,7 @@ extern ParseNamespaceItem *addRangeTableEntry(ParseState *pstate,
|
|||
bool inFromCl);
|
||||
extern ParseNamespaceItem *addRangeTableEntryForRelation(ParseState *pstate,
|
||||
Relation rel,
|
||||
int lockmode,
|
||||
LOCKMODE lockmode,
|
||||
Alias *alias,
|
||||
bool inh,
|
||||
bool inFromCl);
|
||||
|
|
|
|||
Loading…
Reference in a new issue