blob: b939c2c05e1b79baac4dcc53531c3ede0ee457e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*-------------------------------------------------------------------------
*
* superuser.c--
*
* The superuser() function. Determines if user has superuser privilege.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.2 1996/11/03 23:46:28 scrappy Exp $
*
* DESCRIPTION
* See superuser().
*-------------------------------------------------------------------------
*/
#include <postgres.h>
#include <utils/syscache.h>
#include <catalog/pg_user.h>
bool
superuser(void) {
/*--------------------------------------------------------------------------
The Postgres user running this command has Postgres superuser
privileges.
--------------------------------------------------------------------------*/
extern char *UserName; /* defined in global.c */
HeapTuple utup;
utup = SearchSysCacheTuple(USENAME, PointerGetDatum(UserName),
0,0,0);
Assert(utup != NULL);
return ((Form_pg_user)GETSTRUCT(utup))->usesuper;
}
|