mirror of
https://github.com/zebrajr/postgres.git
synced 2025-12-07 00:20:24 +01:00
When reporting "conflicting or redundant options" errors, try to ensure that errposition() is used, to help the user identify the offending option. Formerly, errposition() was invoked in less than 60% of cases. This patch raises that to over 90%, but there remain a few places where the ParseState is not readily available. Using errdetail() might improve the error in such cases, but that is left as a task for the future. Additionally, since this error is thrown from over 100 places in the codebase, introduce a dedicated function to throw it, reducing code duplication. Extracted from a slightly larger patch by Vignesh C. Reviewed by Bharath Rupireddy, Alvaro Herrera, Dilip Kumar, Hou Zhijie, Peter Smith, Daniel Gustafsson, Julien Rouhaud and me. Discussion: https://postgr.es/m/CALDaNm33FFSS5tVyvmkoK2cCMuDVxcui=gFrjti9ROfynqSAGA@mail.gmail.com
38 lines
1.3 KiB
C
38 lines
1.3 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* user.h
|
|
* Commands for manipulating roles (formerly called users).
|
|
*
|
|
*
|
|
* src/include/commands/user.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef USER_H
|
|
#define USER_H
|
|
|
|
#include "catalog/objectaddress.h"
|
|
#include "libpq/crypt.h"
|
|
#include "nodes/parsenodes.h"
|
|
#include "parser/parse_node.h"
|
|
|
|
/* GUC. Is actually of type PasswordType. */
|
|
extern int Password_encryption;
|
|
|
|
/* Hook to check passwords in CreateRole() and AlterRole() */
|
|
typedef void (*check_password_hook_type) (const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null);
|
|
|
|
extern PGDLLIMPORT check_password_hook_type check_password_hook;
|
|
|
|
extern Oid CreateRole(ParseState *pstate, CreateRoleStmt *stmt);
|
|
extern Oid AlterRole(ParseState *pstate, AlterRoleStmt *stmt);
|
|
extern Oid AlterRoleSet(AlterRoleSetStmt *stmt);
|
|
extern void DropRole(DropRoleStmt *stmt);
|
|
extern void GrantRole(GrantRoleStmt *stmt);
|
|
extern ObjectAddress RenameRole(const char *oldname, const char *newname);
|
|
extern void DropOwnedObjects(DropOwnedStmt *stmt);
|
|
extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt);
|
|
extern List *roleSpecsToIds(List *memberNames);
|
|
|
|
#endif /* USER_H */
|