Test for correct timestamps in cdb_tablemetadata_text
This commit is contained in:
parent
acd101af9b
commit
5c86029029
@ -388,6 +388,36 @@ function test_cdb_tablemetadatatouch_fully_qualifies_names() {
|
||||
sql postgres 'DROP TABLE touch_invalidations'
|
||||
}
|
||||
|
||||
function test_cdb_tablemetadata_text() {
|
||||
|
||||
#create and touch tables
|
||||
sql "CREATE TABLE touch_ex_a (id int);"
|
||||
sql "CREATE TABLE touch_ex_b (id int);"
|
||||
sql "CREATE TABLE touch_ex_c (id int);"
|
||||
sql postgres "SELECT CDB_TableMetadataTouch('touch_ex_a');"
|
||||
sql postgres "SELECT CDB_TableMetadataTouch('touch_ex_b');"
|
||||
sql postgres "SELECT CDB_TableMetadataTouch('touch_ex_c');"
|
||||
|
||||
#ensure there is 1 record per table
|
||||
QUERY="SELECT COUNT(1) FROM (SELECT 1 FROM cdb_tablemetadata_text "
|
||||
QUERY+="GROUP BY tabname HAVING COUNT(1) > 1) s;"
|
||||
sql postgres "$QUERY" should "0"
|
||||
|
||||
#ensure timestamps are distinct and properly ordered
|
||||
QUERY="SELECT (SELECT updated_at FROM CDB_TableMetadata_Text WHERE tabname='public.touch_ex_a')"
|
||||
QUERY+=" < (SELECT updated_at FROM CDB_TableMetadata_Text WHERE tabname='public.touch_ex_b');"
|
||||
sql postgres "$QUERY" should "t"
|
||||
QUERY="SELECT (SELECT updated_at FROM CDB_TableMetadata_Text WHERE tabname='public.touch_ex_b')"
|
||||
QUERY+=" < (SELECT updated_at FROM CDB_TableMetadata_Text WHERE tabname='public.touch_ex_c');"
|
||||
sql postgres "$QUERY" should "t"
|
||||
|
||||
#cleanup
|
||||
sql "DROP TABLE touch_ex_a;"
|
||||
sql "DROP TABLE touch_ex_b;"
|
||||
sql "DROP TABLE touch_ex_c;"
|
||||
|
||||
}
|
||||
|
||||
function test_cdb_column_names() {
|
||||
sql cdb_testmember_1 'CREATE TABLE cdb_testmember_1.table_cnames(c int, a int, r int, t int, o int);'
|
||||
sql cdb_testmember_2 'CREATE TABLE cdb_testmember_2.table_cnames(d int, b int);'
|
||||
|
Loading…
Reference in New Issue
Block a user