pg_authid.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pg_authid.h
  4. * definition of the system "authorization identifier" relation (pg_authid)
  5. * along with the relation's initial contents.
  6. *
  7. * pg_shadow and pg_group are now publicly accessible views on pg_authid.
  8. *
  9. *
  10. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  11. * Portions Copyright (c) 1994, Regents of the University of California
  12. *
  13. * src/include/catalog/pg_authid.h
  14. *
  15. * NOTES
  16. * the genbki.pl script reads this file and generates .bki
  17. * information from the DATA() statements.
  18. *
  19. *-------------------------------------------------------------------------
  20. */
  21. #ifndef PG_AUTHID_H
  22. #define PG_AUTHID_H
  23. #include "catalog/genbki.h"
  24. /*
  25. * The CATALOG definition has to refer to the type of rolvaliduntil as
  26. * "timestamptz" (lower case) so that bootstrap mode recognizes it. But
  27. * the C header files define this type as TimestampTz. Since the field is
  28. * potentially-null and therefore can't be accessed directly from C code,
  29. * there is no particular need for the C struct definition to show the
  30. * field type as TimestampTz --- instead we just make it int.
  31. */
  32. #define timestamptz int
  33. /* ----------------
  34. * pg_authid definition. cpp turns this into
  35. * typedef struct FormData_pg_authid
  36. * ----------------
  37. */
  38. #define AuthIdRelationId 1260
  39. #define AuthIdRelation_Rowtype_Id 2842
  40. CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MACRO
  41. {
  42. NameData rolname; /* name of role */
  43. bool rolsuper; /* read this field via superuser() only! */
  44. bool rolinherit; /* inherit privileges from other roles? */
  45. bool rolcreaterole; /* allowed to create more roles? */
  46. bool rolcreatedb; /* allowed to create databases? */
  47. bool rolcanlogin; /* allowed to log in as session user? */
  48. bool rolreplication; /* role used for streaming replication */
  49. bool rolbypassrls; /* bypasses row level security? */
  50. int32 rolconnlimit; /* max connections allowed (-1=no limit) */
  51. /* remaining fields may be null; use heap_getattr to read them! */
  52. #ifdef CATALOG_VARLEN /* variable-length fields start here */
  53. text rolpassword; /* password, if any */
  54. timestamptz rolvaliduntil; /* password expiration time, if any */
  55. #endif
  56. } FormData_pg_authid;
  57. #undef timestamptz
  58. /* ----------------
  59. * Form_pg_authid corresponds to a pointer to a tuple with
  60. * the format of pg_authid relation.
  61. * ----------------
  62. */
  63. typedef FormData_pg_authid *Form_pg_authid;
  64. /* ----------------
  65. * compiler constants for pg_authid
  66. * ----------------
  67. */
  68. #define Natts_pg_authid 11
  69. #define Anum_pg_authid_rolname 1
  70. #define Anum_pg_authid_rolsuper 2
  71. #define Anum_pg_authid_rolinherit 3
  72. #define Anum_pg_authid_rolcreaterole 4
  73. #define Anum_pg_authid_rolcreatedb 5
  74. #define Anum_pg_authid_rolcanlogin 6
  75. #define Anum_pg_authid_rolreplication 7
  76. #define Anum_pg_authid_rolbypassrls 8
  77. #define Anum_pg_authid_rolconnlimit 9
  78. #define Anum_pg_authid_rolpassword 10
  79. #define Anum_pg_authid_rolvaliduntil 11
  80. /* ----------------
  81. * initial contents of pg_authid
  82. *
  83. * The uppercase quantities will be replaced at initdb time with
  84. * user choices.
  85. *
  86. * If adding new default roles or changing the OIDs below, be sure to add or
  87. * update the #defines which follow as appropriate.
  88. * ----------------
  89. */
  90. DATA(insert OID = 10 ( "POSTGRES" t t t t t t t -1 _null_ _null_));
  91. DATA(insert OID = 4200 ( "pg_signal_backend" f t f f f f f -1 _null_ _null_));
  92. #define BOOTSTRAP_SUPERUSERID 10
  93. #define DEFAULT_ROLE_SIGNAL_BACKENDID 4200
  94. #endif /* PG_AUTHID_H */