mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-29 22:49:41 +03:00 
			
		
		
		
	Combine options for RangeVarGetRelidExtended() into a flags argument.
A followup patch will add a SKIP_LOCKED option. To avoid introducing evermore arguments, breaking existing callers each time, introduce a flags argument. This'll no doubt break a few external users... Also change the MISSING_OK behaviour so a DEBUG1 debug message is emitted when a relation is not found. Author: Nathan Bossart Reviewed-By: Michael Paquier and Andres Freund Discussion: https://postgr.es/m/20180306005349.b65whmvj7z6hbe2y@alap3.anarazel.de
This commit is contained in:
		| @@ -47,14 +47,24 @@ typedef struct OverrideSearchPath | ||||
| 	bool		addTemp;		/* implicitly prepend temp schema? */ | ||||
| } OverrideSearchPath; | ||||
|  | ||||
| /* | ||||
|  * Option flag bits for RangeVarGetRelidExtended(). | ||||
|  */ | ||||
| typedef enum RVROption | ||||
| { | ||||
| 	RVR_MISSING_OK = 1 << 0,	/* don't error if relation doesn't exist */ | ||||
| 	RVR_NOWAIT = 1 << 1			/* error if relation cannot be locked */ | ||||
| } RVROption; | ||||
|  | ||||
| typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId, | ||||
| 										  Oid oldRelId, void *callback_arg); | ||||
|  | ||||
| #define RangeVarGetRelid(relation, lockmode, missing_ok) \ | ||||
| 	RangeVarGetRelidExtended(relation, lockmode, missing_ok, false, NULL, NULL) | ||||
| 	RangeVarGetRelidExtended(relation, lockmode, \ | ||||
| 							 (missing_ok) ? RVR_MISSING_OK : 0, NULL, NULL) | ||||
|  | ||||
| extern Oid RangeVarGetRelidExtended(const RangeVar *relation, | ||||
| 						 LOCKMODE lockmode, bool missing_ok, bool nowait, | ||||
| 						 LOCKMODE lockmode, uint32 flags, | ||||
| 						 RangeVarGetRelidCallback callback, | ||||
| 						 void *callback_arg); | ||||
| extern Oid	RangeVarGetCreationNamespace(const RangeVar *newRelation); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user