deparse_utility.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*-------------------------------------------------------------------------
  2. *
  3. * deparse_utility.h
  4. *
  5. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  6. * Portions Copyright (c) 1994, Regents of the University of California
  7. *
  8. * src/include/tcop/deparse_utility.h
  9. *
  10. *-------------------------------------------------------------------------
  11. */
  12. #ifndef DEPARSE_UTILITY_H
  13. #define DEPARSE_UTILITY_H
  14. #include "access/attnum.h"
  15. #include "catalog/objectaddress.h"
  16. #include "nodes/nodes.h"
  17. #include "utils/aclchk_internal.h"
  18. /*
  19. * Support for keeping track of collected commands.
  20. */
  21. typedef enum CollectedCommandType
  22. {
  23. SCT_Simple,
  24. SCT_AlterTable,
  25. SCT_Grant,
  26. SCT_AlterOpFamily,
  27. SCT_AlterDefaultPrivileges,
  28. SCT_CreateOpClass,
  29. SCT_AlterTSConfig
  30. } CollectedCommandType;
  31. /*
  32. * For ALTER TABLE commands, we keep a list of the subcommands therein.
  33. */
  34. typedef struct CollectedATSubcmd
  35. {
  36. ObjectAddress address; /* affected column, constraint, index, ... */
  37. Node *parsetree;
  38. } CollectedATSubcmd;
  39. typedef struct CollectedCommand
  40. {
  41. CollectedCommandType type;
  42. bool in_extension;
  43. Node *parsetree;
  44. union
  45. {
  46. /* most commands */
  47. struct
  48. {
  49. ObjectAddress address;
  50. ObjectAddress secondaryObject;
  51. } simple;
  52. /* ALTER TABLE, and internal uses thereof */
  53. struct
  54. {
  55. Oid objectId;
  56. Oid classId;
  57. List *subcmds;
  58. } alterTable;
  59. /* GRANT / REVOKE */
  60. struct
  61. {
  62. InternalGrant *istmt;
  63. } grant;
  64. /* ALTER OPERATOR FAMILY */
  65. struct
  66. {
  67. ObjectAddress address;
  68. List *operators;
  69. List *procedures;
  70. } opfam;
  71. /* CREATE OPERATOR CLASS */
  72. struct
  73. {
  74. ObjectAddress address;
  75. List *operators;
  76. List *procedures;
  77. } createopc;
  78. /* ALTER TEXT SEARCH CONFIGURATION ADD/ALTER/DROP MAPPING */
  79. struct
  80. {
  81. ObjectAddress address;
  82. Oid *dictIds;
  83. int ndicts;
  84. } atscfg;
  85. /* ALTER DEFAULT PRIVILEGES */
  86. struct
  87. {
  88. GrantObjectType objtype;
  89. } defprivs;
  90. } d;
  91. } CollectedCommand;
  92. #endif /* DEPARSE_UTILITY_H */