From 7f58e1f690bdb2e83a58662338ed6a685fae1c17 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Tue, 31 Mar 2015 14:48:45 +0200 Subject: [PATCH] Adds tests for cdb_tablemetadatatouch - fixes tableoid by using the proper table oid - tests quoted and unqouted call with OID - tests non existent table to fail --- test/extension/test.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/extension/test.sh b/test/extension/test.sh index 7a6af4f..9f7fbd2 100755 --- a/test/extension/test.sh +++ b/test/extension/test.sh @@ -303,8 +303,22 @@ function test_cdb_tablemetadatatouch() { sql "SELECT CDB_TableMetadataTouch('\"public\".\"touch_example\"');" # Works with OID - TABLE_OID=`${CMD} -U postgres ${DATABASE} -c "SELECT tableoid FROM pg_attribute WHERE attrelid = 'touch_example'::regclass limit 1;" -A -t` + sql postgres "SELECT tabname from CDB_TableMetadata;" should 'touch_example' + sql postgres "SELECT count(*) from CDB_TableMetadata;" should 1 + TABLE_OID=`${CMD} -U postgres ${DATABASE} -c "SELECT attrelid FROM pg_attribute WHERE attrelid = 'touch_example'::regclass limit 1;" -A -t` + + # quoted OID works sql "SELECT CDB_TableMetadataTouch('${TABLE_OID}');" + sql postgres "SELECT tabname from CDB_TableMetadata;" should 'touch_example' + sql postgres "SELECT count(*) from CDB_TableMetadata;" should 1 + + # non quoted OID works + sql "SELECT CDB_TableMetadataTouch(${TABLE_OID});" + sql postgres "SELECT tabname from CDB_TableMetadata;" should 'touch_example' + sql postgres "SELECT count(*) from CDB_TableMetadata;" should 1 + + # non existent tables fails + sql postgres "SELECT CDB_TableMetadataTouch('wadus_table_name');" fails #### test tear down sql 'DROP TABLE touch_example;'