ddl-extended.pt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # Test that multiple DDL statements in the same extended request are supported
  2. send
  3. Query {"query": "DROP TABLE IF EXISTS a"}
  4. Query {"query": "DROP TABLE IF EXISTS b"}
  5. ----
  6. until ignore=NoticeResponse
  7. ReadyForQuery
  8. ReadyForQuery
  9. ----
  10. CommandComplete {"tag":"DROP TABLE"}
  11. ReadyForQuery {"status":"I"}
  12. CommandComplete {"tag":"DROP TABLE"}
  13. ReadyForQuery {"status":"I"}
  14. send
  15. Parse {"query": "CREATE TABLE a (a int)"}
  16. Bind
  17. Execute
  18. Parse {"query": "CREATE TABLE b (a int)"}
  19. Bind
  20. Execute
  21. Parse {"query": "SELECT 1/0"}
  22. Bind
  23. Execute
  24. Sync
  25. ----
  26. until
  27. ReadyForQuery
  28. ----
  29. ParseComplete
  30. BindComplete
  31. CommandComplete {"tag":"CREATE TABLE"}
  32. ParseComplete
  33. BindComplete
  34. CommandComplete {"tag":"CREATE TABLE"}
  35. ParseComplete
  36. BindComplete
  37. ErrorResponse {"fields":[{"typ":"S","value":"ERROR"},{"typ":"C","value":"XX000"},{"typ":"M","value":"division by zero"}]}
  38. ReadyForQuery {"status":"I"}
  39. send
  40. Parse {"query": "SELECT * FROM a"}
  41. Bind
  42. Execute
  43. Sync
  44. ----
  45. until
  46. ReadyForQuery
  47. ----
  48. ParseComplete
  49. BindComplete
  50. CommandComplete {"tag":"SELECT 0"}
  51. ReadyForQuery {"status":"I"}
  52. # Test what happens with rollback'd DDLs in extended protocol.
  53. #
  54. # Note: This only works in versions of Postgres with
  55. # https://github.com/postgres/postgres/commit/f92944137cdec3e80e826879d817a2d3dff68b5f
  56. # applied, which at the time of writing is none of them. The following output
  57. # was generated by a Postgres server built from source that included that
  58. # commit.
  59. send
  60. Query {"query": "DROP DATABASE IF EXISTS a"}
  61. Query {"query": "DROP DATABASE IF EXISTS b"}
  62. ----
  63. until ignore=NoticeResponse
  64. ReadyForQuery
  65. ReadyForQuery
  66. ----
  67. CommandComplete {"tag":"DROP DATABASE"}
  68. ReadyForQuery {"status":"I"}
  69. CommandComplete {"tag":"DROP DATABASE"}
  70. ReadyForQuery {"status":"I"}
  71. send
  72. Parse {"query": "SELECT 1 FROM pg_type LIMIT 0"}
  73. Bind
  74. Execute
  75. Parse {"query": "CREATE DATABASE a"}
  76. Bind
  77. Execute
  78. Parse {"query": "ROLLBACK"}
  79. Bind
  80. Execute
  81. Sync
  82. ----
  83. until
  84. ReadyForQuery
  85. ----
  86. ParseComplete
  87. BindComplete
  88. CommandComplete {"tag":"SELECT 0"}
  89. ParseComplete
  90. BindComplete
  91. CommandComplete {"tag":"CREATE DATABASE"}
  92. ParseComplete
  93. BindComplete
  94. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"25P01"},{"typ":"M","value":"there is no transaction in progress"}]}
  95. CommandComplete {"tag":"ROLLBACK"}
  96. ReadyForQuery {"status":"I"}
  97. send
  98. Parse {"query": "CREATE DATABASE b"}
  99. Bind
  100. Execute
  101. Parse {"query": "SELECT 1 FROM pg_type LIMIT 0"}
  102. Bind
  103. Execute
  104. Parse {"query": "ROLLBACK"}
  105. Bind
  106. Execute
  107. Sync
  108. ----
  109. until
  110. ReadyForQuery
  111. ----
  112. ParseComplete
  113. BindComplete
  114. CommandComplete {"tag":"CREATE DATABASE"}
  115. ParseComplete
  116. BindComplete
  117. CommandComplete {"tag":"SELECT 0"}
  118. ParseComplete
  119. BindComplete
  120. NoticeResponse {"fields":[{"typ":"S","value":"WARNING"},{"typ":"C","value":"25P01"},{"typ":"M","value":"there is no transaction in progress"}]}
  121. CommandComplete {"tag":"ROLLBACK"}
  122. ReadyForQuery {"status":"I"}
  123. send
  124. Query {"query": "SELECT datname FROM pg_catalog.pg_database WHERE datname IN ('a', 'b') ORDER BY datname"}
  125. ----
  126. until
  127. ReadyForQuery
  128. ----
  129. RowDescription {"fields":[{"name":"datname"}]}
  130. DataRow {"fields":["a"]}
  131. DataRow {"fields":["b"]}
  132. CommandComplete {"tag":"SELECT 2"}
  133. ReadyForQuery {"status":"I"}