]> granicus.if.org Git - postgresql/blob - src/backend/utils/misc/superuser.c
Add system indexes to match all caches.
[postgresql] / src / backend / utils / misc / superuser.c
1 /*-------------------------------------------------------------------------
2  *
3  * superuser.c
4  *
5  *        The superuser() function.  Determines if user has superuser privilege.
6  *
7  * Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  *        $Header: /cvsroot/pgsql/src/backend/utils/misc/superuser.c,v 1.11 1999/11/22 17:56:35 momjian Exp $
12  *
13  * DESCRIPTION
14  *        See superuser().
15  *-------------------------------------------------------------------------
16  */
17
18 #include "postgres.h"
19 #include "catalog/pg_shadow.h"
20 #include "utils/syscache.h"
21
22 bool
23 superuser(void)
24 {
25 /*--------------------------------------------------------------------------
26         The Postgres user running this command has Postgres superuser
27         privileges.
28 --------------------------------------------------------------------------*/
29         extern char *UserName;          /* defined in global.c */
30
31         HeapTuple       utup;
32
33         utup = SearchSysCacheTuple(USERNAME,
34                                                            PointerGetDatum(UserName),
35                                                            0, 0, 0);
36         Assert(utup != NULL);
37         return ((Form_pg_shadow) GETSTRUCT(utup))->usesuper;
38 }