Tuesday, May 26, 2015

Postgresql: REINDEX DATABASE requires double quotes within psql.

Learned that, the psql reindex requires double quotes.

I would usually performs the reindex within psql.


VCDB=#
VCDB=# REINDEX DATABASE VCDB;
ERROR:  can only reindex the currently open database
VCDB=# REINDEX DATABASE "VCDB";




NOTICE:  table "pg_catalog.pg_class" was reindexed
NOTICE:  table "pg_catalog.pg_statistic" was reindexed
NOTICE:  table "pg_catalog.pg_type" was reindexed
NOTICE:  table "vc.cis_kv_providers" was reindexed
NOTICE:  table "pg_catalog.pg_authid" was reindexed
NOTICE:  table "pg_catalog.pg_attribute" was reindexed
NOTICE:  table "pg_catalog.pg_proc" was reindexed
NOTICE:  table "vc.cis_kv_keyvalue" was reindexed
NOTICE:  table "pg_catalog.pg_user_mapping" was reindexed
NOTICE:  table "pg_catalog.pg_constraint" was reindexed
NOTICE:  table "pg_catalog.pg_inherits" was reindexed
NOTICE:  table "pg_catalog.pg_index" was reindexed
NOTICE:  table "pg_catalog.pg_operator" was reindexed
NOTICE:  table "pg_catalog.pg_opfamily" was reindexed

Today, for the fun of it, i performed Reindex with command line and it errors out. I do not see a logical reason to have the double quotes.


localhost:/opt/vmware/vpostgres/current/bin # ./reindexdb -U postgres -d VCDB
NOTICE:  table "pg_catalog.pg_class" was reindexed
NOTICE:  table "pg_catalog.pg_statistic" was reindexed
NOTICE:  table "pg_catalog.pg_type" was reindexed
NOTICE:  table "vc.cis_kv_providers" was reindexed
NOTICE:  table "pg_catalog.pg_authid" was reindexed
NOTICE:  table "pg_catalog.pg_attribute" was reindexed
NOTICE:  table "pg_catalog.pg_proc" was reindexed
NOTICE:  table "vc.cis_kv_keyvalue" was reindexed
NOTICE:  table "pg_catalog.pg_user_mapping" was reindexed
NOTICE:  table "pg_catalog.pg_constraint" was reindexed




No comments:

Post a Comment