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
This commit is contained in:
Raul Ochoa 2015-03-31 14:48:45 +02:00
parent ca643b2e03
commit 7f58e1f690

View File

@ -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;'