forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pgwire/pgtest: make the tests work both on pg and crdb
There was some accumulated incompatibilities in the test files. This patch fixes it, and in the process of doing so discovers two new bugs (cockroachdb#49639 and cockroachdb#49640). Summary of changes to the DSL: - the new `only` directive skips an entire test file if the db does not match (used for the crdb-specific portal bug test file) - the new flags `crdb_only` and `noncrdb_only` skip over a test directive if the db does not match. - the new flags `ignore_table_oids` and `ignore_type_oids` replace the corresponding OIDs in the RowDescription message by 0 prior to comparing with the expected value. Release note: None
- Loading branch information
Showing
9 changed files
with
290 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,92 @@ | ||
# Test notices work as expected by creating a VIEW on a TEMP TABLE. | ||
|
||
|
||
# Prepare the environment. | ||
|
||
send | ||
Parse {"Query": "CREATE TABLE t(x INT, y INT, INDEX (x), INDEX (y))"} | ||
Bind | ||
Execute | ||
Sync | ||
Query {"String": "DROP TABLE IF EXISTS t CASCADE"} | ||
---- | ||
|
||
until ignore=NoticeResponse | ||
ReadyForQuery | ||
---- | ||
{"Type":"CommandComplete","CommandTag":"DROP TABLE"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
# Start of test. | ||
|
||
send | ||
Query {"String": "CREATE TABLE t(x INT, y INT)"} | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"CommandComplete","CommandTag":"CREATE TABLE"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
send | ||
Query {"String": "CREATE INDEX t_x_idx ON t(x)"} | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"CommandComplete","CommandTag":"CREATE INDEX"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
send | ||
Parse {"Query": "DROP INDEX t@t_x_idx"} | ||
Bind | ||
Execute | ||
Sync | ||
Query {"String": "CREATE INDEX t_y_idx ON t(y)"} | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"CommandComplete","CommandTag":"CREATE INDEX"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
|
||
# Check that crdb reports a notice upon drop index. | ||
|
||
send | ||
Query {"String": "DROP INDEX t_x_idx"} | ||
---- | ||
|
||
until crdb_only | ||
CommandComplete | ||
---- | ||
{"Severity":"NOTICE","Code":"00000","Message":"the data for dropped indexes is reclaimed asynchronously","Detail":"","Hint":"The reclamation delay can be customized in the zone configuration for the table.","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"drop_index.go","Line":500,"Routine":"dropIndexByName","UnknownFields":null} | ||
{"Type":"CommandComplete","CommandTag":"DROP INDEX"} | ||
|
||
until noncrdb_only | ||
CommandComplete | ||
---- | ||
{"Type":"CommandComplete","CommandTag":"DROP INDEX"} | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
# Disable notices and assert now it is not sent. | ||
send | ||
Parse {"Query": "SET CLUSTER SETTING sql.notices.enabled = false"} | ||
Bind | ||
Execute | ||
Sync | ||
send crdb_only | ||
Query {"String": "SET CLUSTER SETTING sql.notices.enabled = false"} | ||
---- | ||
|
||
until | ||
until crdb_only | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"CommandComplete","CommandTag":"SET CLUSTER SETTING"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
# Check that the notice is not printed any more. | ||
|
||
send | ||
Parse {"Query": "DROP INDEX t@t_y_idx"} | ||
Bind | ||
Execute | ||
Sync | ||
Query {"String": "DROP INDEX t_y_idx"} | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"CommandComplete","CommandTag":"DROP INDEX"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} |
Oops, something went wrong.