mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 01:21:48 +03:00
Make all system indexes unique. Make all cache loads use system indexes. Rename *rel to *relid in inheritance tables. Rename cache names to be clearer.
39 lines
1.0 KiB
C
39 lines
1.0 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* 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.11 1999/11/22 17:56:35 momjian Exp $
|
|
*
|
|
* DESCRIPTION
|
|
* See superuser().
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
#include "catalog/pg_shadow.h"
|
|
#include "utils/syscache.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(USERNAME,
|
|
PointerGetDatum(UserName),
|
|
0, 0, 0);
|
|
Assert(utup != NULL);
|
|
return ((Form_pg_shadow) GETSTRUCT(utup))->usesuper;
|
|
}
|