forked from MaterializeInc/materialize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
desc.pt
186 lines (163 loc) · 4.2 KB
/
desc.pt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Test that prepared statement describe works if the underlying SQL object is
# replaced.
send
Query {"query": "DROP TABLE IF EXISTS t"}
----
until ignore=NoticeResponse
ReadyForQuery
----
CommandComplete {"tag":"DROP TABLE"}
ReadyForQuery {"status":"I"}
send
Query {"query": "CREATE TABLE t (a INT)"}
Parse {"name": "q", "query": "SELECT * FROM t"}
Describe {"variant": "S", "name": "q"}
Sync
----
until
ReadyForQuery
ReadyForQuery
----
CommandComplete {"tag":"CREATE TABLE"}
ReadyForQuery {"status":"I"}
ParseComplete
ParameterDescription {"parameters":[]}
RowDescription {"fields":[{"name":"a"}]}
ReadyForQuery {"status":"I"}
# Recreating the underlying object is fine.
send
Query {"query": "DROP TABLE t"}
Query {"query": "CREATE TABLE t (a INT)"}
Describe {"variant": "S", "name": "q"}
Sync
Query {"query": "EXECUTE q"}
----
until
ReadyForQuery
ReadyForQuery
ReadyForQuery
ReadyForQuery
----
CommandComplete {"tag":"DROP TABLE"}
ReadyForQuery {"status":"I"}
CommandComplete {"tag":"CREATE TABLE"}
ReadyForQuery {"status":"I"}
ParameterDescription {"parameters":[]}
RowDescription {"fields":[{"name":"a"}]}
ReadyForQuery {"status":"I"}
RowDescription {"fields":[{"name":"a"}]}
CommandComplete {"tag":"SELECT 0"}
ReadyForQuery {"status":"I"}
# But changing it will break the prepared statement.
send
Query {"query": "DROP TABLE t"}
Query {"query": "CREATE TABLE t (c INT, b INT)"}
----
until
ReadyForQuery
ReadyForQuery
----
CommandComplete {"tag":"DROP TABLE"}
ReadyForQuery {"status":"I"}
CommandComplete {"tag":"CREATE TABLE"}
ReadyForQuery {"status":"I"}
send
Describe {"variant": "S", "name": "q"}
Sync
----
# Postgres sends a ParameterDescription, but that seems wrong, so ignore it and
# just look for the error.
until ignore=ParameterDescription
ReadyForQuery
----
ErrorResponse {"fields":[{"typ":"S","value":"ERROR"},{"typ":"C","value":"0A000"},{"typ":"M","value":"cached plan must not change result type"}]}
ReadyForQuery {"status":"I"}
send
Query {"query": "EXECUTE q"}
----
# TODO(mjibson): We send a RowDescription before the error. This isn't wrong
# (feels about as wrong as Postgres sending ParameterDescription above), it's
# just not what Postgres does, so ignore it to be in sync with them.
until ignore=RowDescription
ReadyForQuery
----
ErrorResponse {"fields":[{"typ":"S","value":"ERROR"},{"typ":"C","value":"0A000"},{"typ":"M","value":"cached plan must not change result type"}]}
ReadyForQuery {"status":"I"}
# Changing it back fixes it.
send
Query {"query": "DROP TABLE t"}
Query {"query": "CREATE TABLE t (a INT)"}
Describe {"variant": "S", "name": "q"}
Sync
Query {"query": "EXECUTE q"}
----
until
ReadyForQuery
ReadyForQuery
ReadyForQuery
ReadyForQuery
----
CommandComplete {"tag":"DROP TABLE"}
ReadyForQuery {"status":"I"}
CommandComplete {"tag":"CREATE TABLE"}
ReadyForQuery {"status":"I"}
ParameterDescription {"parameters":[]}
RowDescription {"fields":[{"name":"a"}]}
ReadyForQuery {"status":"I"}
RowDescription {"fields":[{"name":"a"}]}
CommandComplete {"tag":"SELECT 0"}
ReadyForQuery {"status":"I"}
# Check portals.
send
Bind {"statement": "q", "portal": "p"}
Describe {"variant": "P", "name": "p"}
Sync
----
until
ReadyForQuery
----
BindComplete
RowDescription {"fields":[{"name":"a"}]}
ReadyForQuery {"status":"I"}
send
Query {"query": "DROP TABLE t"}
Query {"query": "CREATE TABLE t (c INT, b INT)"}
----
until
ReadyForQuery
ReadyForQuery
----
CommandComplete {"tag":"DROP TABLE"}
ReadyForQuery {"status":"I"}
CommandComplete {"tag":"CREATE TABLE"}
ReadyForQuery {"status":"I"}
# Can't bind because the statement changed.
send
Bind {"statement": "q", "portal": "p"}
Sync
----
until
ReadyForQuery
----
ErrorResponse {"fields":[{"typ":"S","value":"ERROR"},{"typ":"C","value":"0A000"},{"typ":"M","value":"cached plan must not change result type"}]}
ReadyForQuery {"status":"I"}
# Changing it back fixes it.
send
Query {"query": "DROP TABLE t"}
Query {"query": "CREATE TABLE t (a INT)"}
Bind {"statement": "q", "portal": "p"}
Describe {"variant": "P", "name": "p"}
Sync
----
until
ReadyForQuery
ReadyForQuery
ReadyForQuery
----
CommandComplete {"tag":"DROP TABLE"}
ReadyForQuery {"status":"I"}
CommandComplete {"tag":"CREATE TABLE"}
ReadyForQuery {"status":"I"}
BindComplete
RowDescription {"fields":[{"name":"a"}]}
ReadyForQuery {"status":"I"}