mirror of https://github.com/citusdata/citus.git
Allow LOCK TABLE to be run in a procedure / function
parent
3debcd4f38
commit
1f926db4fa
|
@ -472,9 +472,9 @@ ProcessUtilityInternal(PlannedStmt *pstmt,
|
|||
{
|
||||
LockStmt *stmt = (LockStmt *) parsetree;
|
||||
|
||||
ereport(NOTICE, errmsg("Processing LOCK command."));
|
||||
bool isTopLevel = context == PROCESS_UTILITY_TOPLEVEL;
|
||||
ErrorIfUnsupportedLockStmt(stmt, isTopLevel);
|
||||
|
||||
ErrorIfUnsupportedLockStmt(stmt);
|
||||
uint32 nowaitFlag = stmt->nowait ? DIST_LOCK_NOWAIT : 0;
|
||||
AcquireDistributedLockOnRelations(stmt->relations, stmt->mode,
|
||||
DIST_LOCK_VIEWS_RECUR | nowaitFlag);
|
||||
|
|
|
@ -1253,9 +1253,9 @@ AcquireDistributedLockOnRelations(List *relationList, LOCKMODE lockMode, uint32
|
|||
* - Locking shard, but citus.enable_manual_changes_to_shards is false
|
||||
*/
|
||||
void
|
||||
ErrorIfUnsupportedLockStmt(LockStmt *stmt)
|
||||
ErrorIfUnsupportedLockStmt(LockStmt *stmt, bool isTopLevel)
|
||||
{
|
||||
RequireTransactionBlock(true, "LOCK TABLE");
|
||||
RequireTransactionBlock(isTopLevel, "LOCK TABLE");
|
||||
|
||||
RangeVar *rangeVar = NULL;
|
||||
foreach_ptr(rangeVar, stmt->relations)
|
||||
|
|
|
@ -163,5 +163,5 @@ extern LOCKMODE LockModeCStringToLockMode(const char *lockModeName);
|
|||
extern const char * LockModeToLockModeCString(LOCKMODE lockMode);
|
||||
extern void AcquireDistributedLockOnRelations(List *relationList, LOCKMODE lockMode,
|
||||
uint32 configs);
|
||||
extern void ErrorIfUnsupportedLockStmt(LockStmt *stmt);
|
||||
extern void ErrorIfUnsupportedLockStmt(LockStmt *stmt, bool isTopLevel);
|
||||
#endif /* RESOURCE_LOCK_H */
|
||||
|
|
Loading…
Reference in New Issue