123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- # 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"}
|