mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[4.0.x] Fixed #32888 -- Doc'd that select_for_update() only locks tables with selected columns.
Backport of d400b08a8b from main
			
			
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							7fa946c76b
						
					
				
				
					commit
					816e809302
				
			| @@ -1775,6 +1775,12 @@ to refer to the queryset's model. | ||||
|  | ||||
|         Restaurant.objects.select_for_update(of=('self', 'place_ptr')) | ||||
|  | ||||
| .. admonition:: Using ``select_for_update(of=(...))`` with specified fields | ||||
|  | ||||
|     If you want to lock models and specify selected fields, e.g. using | ||||
|     :meth:`values`, you must select at least one field from each model in the | ||||
|     ``of`` argument. Models without selected fields will not be locked. | ||||
|  | ||||
| On PostgreSQL only, you can pass ``no_key=True`` in order to acquire a weaker | ||||
| lock, that still allows creating rows that merely reference locked rows | ||||
| (through a foreign key, for example) while the lock is in place. The | ||||
|   | ||||
		Reference in New Issue
	
	Block a user